aboutsummaryrefslogtreecommitdiffstats
path: root/components/plugins/lints/unrooted_must_root.rs
diff options
context:
space:
mode:
authorAnthony Ramine <n.oxyde@gmail.com>2016-06-06 14:47:16 +0200
committerAnthony Ramine <n.oxyde@gmail.com>2016-06-08 14:03:57 +0200
commitb7f5e8d0135a2fbecc749206a27f84dd10dc2e84 (patch)
tree35ef9c588bcaec229ba5a9491b8db57f2e96c563 /components/plugins/lints/unrooted_must_root.rs
parenta80767993b6b2b885dfac9666f16fb1e1649ac99 (diff)
downloadservo-b7f5e8d0135a2fbecc749206a27f84dd10dc2e84.tar.gz
servo-b7f5e8d0135a2fbecc749206a27f84dd10dc2e84.zip
Update Rust to 1.11.0-nightly (ec872dc8a 2016-06-07)
Diffstat (limited to 'components/plugins/lints/unrooted_must_root.rs')
-rw-r--r--components/plugins/lints/unrooted_must_root.rs15
1 files changed, 6 insertions, 9 deletions
diff --git a/components/plugins/lints/unrooted_must_root.rs b/components/plugins/lints/unrooted_must_root.rs
index 9a9a43d62dc..6e6b6f516c2 100644
--- a/components/plugins/lints/unrooted_must_root.rs
+++ b/components/plugins/lints/unrooted_must_root.rs
@@ -5,7 +5,6 @@
use rustc::hir;
use rustc::hir::intravisit as visit;
use rustc::hir::map as ast_map;
-use rustc::hir::pat_util::pat_is_binding;
use rustc::lint::{LateContext, LintPass, LintArray, LateLintPass, LintContext};
use rustc::ty;
use syntax::attr::AttrMetaMethods;
@@ -199,14 +198,12 @@ impl<'a, 'b: 'a, 'tcx: 'a+'b> visit::Visitor<'a> for FnDefVisitor<'a, 'b, 'tcx>
fn visit_pat(&mut self, pat: &'a hir::Pat) {
let cx = self.cx;
- if let hir::PatKind::Ident(hir::BindingMode::BindByValue(_), _, _) = pat.node {
- if pat_is_binding(&cx.tcx.def_map.borrow(), pat) {
- let ty = cx.tcx.pat_ty(pat);
- if is_unrooted_ty(cx, ty, self.in_new_function) {
- cx.span_lint(UNROOTED_MUST_ROOT,
- pat.span,
- &format!("Expression of type {:?} must be rooted", ty))
- }
+ if let hir::PatKind::Binding(hir::BindingMode::BindByValue(_), _, _) = pat.node {
+ let ty = cx.tcx.pat_ty(pat);
+ if is_unrooted_ty(cx, ty, self.in_new_function) {
+ cx.span_lint(UNROOTED_MUST_ROOT,
+ pat.span,
+ &format!("Expression of type {:?} must be rooted", ty))
}
}