]> git.lizzy.rs Git - rust.git/commitdiff
Rustup to *1.11.0-nightly (7d2f75a95 2016-06-09)*
authormcarton <cartonmartin+git@gmail.com>
Fri, 10 Jun 2016 17:47:10 +0000 (19:47 +0200)
committermcarton <cartonmartin+git@gmail.com>
Fri, 10 Jun 2016 18:08:55 +0000 (20:08 +0200)
clippy_lints/src/drop_ref.rs
clippy_lints/src/enum_glob_use.rs
clippy_lints/src/let_if_seq.rs
clippy_lints/src/mem_forget.rs
clippy_lints/src/minmax.rs
clippy_lints/src/needless_bool.rs
clippy_lints/src/regex.rs
clippy_lints/src/transmute.rs
clippy_lints/src/types.rs

index 69156f15f31767defe95506365ccd5b87d66e46c..268497f99d4483b37f7e7a8a04a03eee763ced88 100644 (file)
@@ -35,7 +35,7 @@ impl LateLintPass for DropRefPass {
     fn check_expr(&mut self, cx: &LateContext, expr: &Expr) {
         if let ExprCall(ref path, ref args) = expr.node {
             if let ExprPath(None, _) = path.node {
-                let def_id = cx.tcx.def_map.borrow()[&path.id].def_id();
+                let def_id = cx.tcx.expect_def(path.id).def_id();
                 if match_def_path(cx, def_id, &paths::DROP) {
                     if args.len() != 1 {
                         return;
index 37a89069d1927d3c9c5d18ebeab5bed5106af5e6..5a4185ec63b9dd71c3dbcdc37381f37c184ef5eb 100644 (file)
@@ -44,14 +44,14 @@ fn lint_item(&self, cx: &LateContext, item: &Item) {
         if let ItemUse(ref item_use) = item.node {
             if let ViewPath_::ViewPathGlob(_) = item_use.node {
                 if let Some(def) = cx.tcx.def_map.borrow().get(&item.id) {
-                    if let Some(node_id) = cx.tcx.map.as_local_node_id(def.def_id()) {
+                    if let Some(node_id) = cx.tcx.map.as_local_node_id(def.full_def().def_id()) {
                         if let Some(NodeItem(it)) = cx.tcx.map.find(node_id) {
                             if let ItemEnum(..) = it.node {
                                 span_lint(cx, ENUM_GLOB_USE, item.span, "don't use glob imports for enum variants");
                             }
                         }
                     } else {
-                        let child = cx.sess().cstore.item_children(def.def_id());
+                        let child = cx.sess().cstore.item_children(def.full_def().def_id());
                         if let Some(child) = child.first() {
                             if let DefLike::DlDef(Def::Variant(..)) = child.def {
                                 span_lint(cx, ENUM_GLOB_USE, item.span, "don't use glob imports for enum variants");
index ac6bee00ff5451ef2a4d9ab7da8a190563cc1dd4..0ed3248228fc1da0cfa7484f50906aa5eb0fcf59 100644 (file)
@@ -69,15 +69,15 @@ fn check_block(&mut self, cx: &LateContext, block: &hir::Block) {
                 let Some(def) = cx.tcx.def_map.borrow().get(&decl.pat.id),
                 let hir::StmtExpr(ref if_, _) = expr.node,
                 let hir::ExprIf(ref cond, ref then, ref else_) = if_.node,
-                !used_in_expr(cx, def.def_id(), cond),
-                let Some(value) = check_assign(cx, def.def_id(), then),
-                !used_in_expr(cx, def.def_id(), value),
+                !used_in_expr(cx, def.full_def().def_id(), cond),
+                let Some(value) = check_assign(cx, def.full_def().def_id(), then),
+                !used_in_expr(cx, def.full_def().def_id(), value),
             ], {
                 let span = codemap::mk_sp(stmt.span.lo, if_.span.hi);
 
                 let (default_multi_stmts, default) = if let Some(ref else_) = *else_ {
                     if let hir::ExprBlock(ref else_) = else_.node {
-                        if let Some(default) = check_assign(cx, def.def_id(), else_) {
+                        if let Some(default) = check_assign(cx, def.full_def().def_id(), else_) {
                             (else_.stmts.len() > 1, default)
                         } else if let Some(ref default) = decl.init {
                             (true, &**default)
@@ -139,7 +139,7 @@ fn visit_expr(&mut self, expr: &'v hir::Expr) {
         if_let_chain! {[
             let hir::ExprPath(None, _) = expr.node,
             let Some(def) = self.cx.tcx.def_map.borrow().get(&expr.id),
-            self.id == def.def_id(),
+            self.id == def.full_def().def_id(),
         ], {
             self.used = true;
             return;
@@ -156,7 +156,7 @@ fn check_assign<'e>(cx: &LateContext, decl: hir::def_id::DefId, block: &'e hir::
         let hir::ExprAssign(ref var, ref value) = expr.node,
         let hir::ExprPath(None, _) = var.node,
         let Some(def) = cx.tcx.def_map.borrow().get(&var.id),
-        decl == def.def_id(),
+        decl == def.full_def().def_id(),
     ], {
         let mut v = UsedVisitor {
             cx: cx,
index 4dfb0fe88e0b7fdeed58b72eadfffae2f13a4a63..79a7143636824a5aeefff20393632eeba0ad62a4 100644 (file)
@@ -27,7 +27,7 @@ impl LateLintPass for MemForget {
     fn check_expr(&mut self, cx: &LateContext, e: &Expr) {
         if let ExprCall(ref path_expr, ref args) = e.node {
             if let ExprPath(None, _) = path_expr.node {
-                let def_id = cx.tcx.def_map.borrow()[&path_expr.id].def_id();
+                let def_id = cx.tcx.expect_def(path_expr.id).def_id();
                 if match_def_path(cx, def_id, &paths::MEM_FORGET) {
                     let forgot_ty = cx.tcx.expr_ty(&args[0]);
 
index eaba19b08e418fc9a843da6adff49a1c05de7dd1..a88324aaf50ff6708d299db2817ce95d3be2b89a 100644 (file)
@@ -55,7 +55,7 @@ enum MinMax {
 fn min_max<'a>(cx: &LateContext, expr: &'a Expr) -> Option<(MinMax, Constant, &'a Expr)> {
     if let ExprCall(ref path, ref args) = expr.node {
         if let ExprPath(None, _) = path.node {
-            let def_id = cx.tcx.def_map.borrow()[&path.id].def_id();
+            let def_id = cx.tcx.expect_def(path.id).def_id();
 
             if match_def_path(cx, def_id, &paths::CMP_MIN) {
                 fetch_const(args, MinMax::Min)
index f95d6f5c9c1b5547a0ddceb3f9f8f8882841c8de..5f912366770c4b2a2d9b4d010bfa5e2b8058cf13 100644 (file)
@@ -155,8 +155,8 @@ enum Expression {
 
 fn fetch_bool_block(block: &Block) -> Expression {
     match (&*block.stmts, block.expr.as_ref()) {
-        ([], Some(e)) => fetch_bool_expr(&**e),
-        ([ref e], None) => {
+        (&[], Some(e)) => fetch_bool_expr(&**e),
+        (&[ref e], None) => {
             if let StmtSemi(ref e, _) = e.node {
                 if let ExprRet(_) = e.node {
                     fetch_bool_expr(&**e)
index 8b84f94fa8e06a3e4f036251e8687e039786ff36..c2c37fcf68665378fafdc0b5a77db26831e378e5 100644 (file)
@@ -103,7 +103,7 @@ fn check_expr(&mut self, cx: &LateContext, expr: &Expr) {
             args.len() == 1,
             let Some(def) = cx.tcx.def_map.borrow().get(&fun.id),
         ], {
-            let def_id = def.def_id();
+            let def_id = def.full_def().def_id();
             if match_def_path(cx, def_id, &paths::REGEX_NEW) ||
                match_def_path(cx, def_id, &paths::REGEX_BUILDER_NEW) {
                 check_regex(cx, &args[0], true);
index 2217fd59bd96594f4901c79bc73d7719f8ac20c3..5d3f27b074b202dc25718e5e8117234fb92232af 100644 (file)
@@ -60,7 +60,7 @@ impl LateLintPass for Transmute {
     fn check_expr(&mut self, cx: &LateContext, e: &Expr) {
         if let ExprCall(ref path_expr, ref args) = e.node {
             if let ExprPath(None, _) = path_expr.node {
-                let def_id = cx.tcx.def_map.borrow()[&path_expr.id].def_id();
+                let def_id = cx.tcx.expect_def(path_expr.id).def_id();
 
                 if match_def_path(cx, def_id, &paths::TRANSMUTE) {
                     let from_ty = cx.tcx.expr_ty(&args[0]);
index 8a1a13187b355e817448497e82319f3c0f6f945c..83e2c1b549c145ecaa3c0ce1ff5307bf6cfe93b6 100644 (file)
@@ -56,7 +56,7 @@ fn check_ty(&mut self, cx: &LateContext, ast_ty: &Ty) {
         }
         if let Some(did) = cx.tcx.def_map.borrow().get(&ast_ty.id) {
             if let def::Def::Struct(..) = did.full_def() {
-                if Some(did.def_id()) == cx.tcx.lang_items.owned_box() {
+                if Some(did.full_def().def_id()) == cx.tcx.lang_items.owned_box() {
                     if_let_chain! {[
                         let TyPath(_, ref path) = ast_ty.node,
                         let Some(ref last) = path.segments.last(),
@@ -64,7 +64,7 @@ fn check_ty(&mut self, cx: &LateContext, ast_ty: &Ty) {
                         let Some(ref vec) = ag.types.get(0),
                         let Some(did) = cx.tcx.def_map.borrow().get(&vec.id),
                         let def::Def::Struct(..) = did.full_def(),
-                        match_def_path(cx, did.def_id(), &paths::VEC),
+                        match_def_path(cx, did.full_def().def_id(), &paths::VEC),
                     ], {
                         span_help_and_lint(cx,
                                            BOX_VEC,
@@ -72,7 +72,7 @@ fn check_ty(&mut self, cx: &LateContext, ast_ty: &Ty) {
                                            "you seem to be trying to use `Box<Vec<T>>`. Consider using just `Vec<T>`",
                                            "`Vec<T>` is already on the heap, `Box<Vec<T>>` makes an extra allocation.");
                     }}
-                } else if match_def_path(cx, did.def_id(), &paths::LINKED_LIST) {
+                } else if match_def_path(cx, did.full_def().def_id(), &paths::LINKED_LIST) {
                     span_help_and_lint(cx,
                                        LINKEDLIST,
                                        ast_ty.span,