]> git.lizzy.rs Git - rust.git/commitdiff
rustup https://github.com/rust-lang/rust/pull/71292/
authorMatthias Krüger <matthias.krueger@famsik.de>
Tue, 28 Apr 2020 13:05:56 +0000 (15:05 +0200)
committerMatthias Krüger <matthias.krueger@famsik.de>
Tue, 28 Apr 2020 13:05:56 +0000 (15:05 +0200)
clippy_lints/src/escape.rs
clippy_lints/src/functions.rs
clippy_lints/src/loops.rs
clippy_lints/src/needless_pass_by_value.rs
clippy_lints/src/utils/mod.rs
clippy_lints/src/utils/usage.rs
clippy_lints/src/wildcard_imports.rs

index 6907e021a00b8261847c455ee842db4c4f59b231..1ec60a0e6e67ac9e00c42e4920d438fafd25ad8c 100644 (file)
@@ -77,7 +77,7 @@ fn check_fn(
 
         let fn_def_id = cx.tcx.hir().local_def_id(hir_id);
         cx.tcx.infer_ctxt().enter(|infcx| {
-            ExprUseVisitor::new(&mut v, &infcx, fn_def_id.to_def_id(), cx.param_env, cx.tables).consume_body(body);
+            ExprUseVisitor::new(&mut v, &infcx, fn_def_id, cx.param_env, cx.tables).consume_body(body);
         });
 
         for node in v.set {
index c8c562fe29f53ebfd7af1c57c40da853767f29f5..c24a24733d7f3bfacd908e5a175eaac03a9cdda5 100644 (file)
@@ -489,7 +489,12 @@ fn is_mutable_pat(cx: &LateContext<'_, '_>, pat: &hir::Pat<'_>, tys: &mut FxHash
     }
     let def_id = pat.hir_id.owner.to_def_id();
     if cx.tcx.has_typeck_tables(def_id) {
-        is_mutable_ty(cx, &cx.tcx.typeck_tables_of(def_id).pat_ty(pat), pat.span, tys)
+        is_mutable_ty(
+            cx,
+            &cx.tcx.typeck_tables_of(def_id.expect_local()).pat_ty(pat),
+            pat.span,
+            tys,
+        )
     } else {
         false
     }
@@ -606,7 +611,7 @@ fn visit_expr(&mut self, expr: &'tcx hir::Expr<'_>) {
                     if self.cx.tcx.has_typeck_tables(def_id)
                         && is_mutable_ty(
                             self.cx,
-                            self.cx.tcx.typeck_tables_of(def_id).expr_ty(arg),
+                            self.cx.tcx.typeck_tables_of(def_id.expect_local()).expr_ty(arg),
                             arg.span,
                             &mut tys,
                         )
index cb44eccae6847462dae702be42ffed3f23448920..f7c7fd82d833b6c71a93c7b3b97fc854d93f9af7 100644 (file)
@@ -1695,7 +1695,7 @@ fn check_for_mutation(
     };
     let def_id = body.hir_id.owner.to_def_id();
     cx.tcx.infer_ctxt().enter(|infcx| {
-        ExprUseVisitor::new(&mut delegate, &infcx, def_id, cx.param_env, cx.tables).walk_expr(body);
+        ExprUseVisitor::new(&mut delegate, &infcx, def_id.expect_local(), cx.param_env, cx.tables).walk_expr(body);
     });
     delegate.mutation_span()
 }
index 200fd5656b4f708c64106cb28f20967a4f93714f..a21818701dacc2fd059bb7387a3dc3f572adc4ea 100644 (file)
@@ -135,8 +135,7 @@ fn check_fn(
         } = {
             let mut ctx = MovedVariablesCtxt::default();
             cx.tcx.infer_ctxt().enter(|infcx| {
-                euv::ExprUseVisitor::new(&mut ctx, &infcx, fn_def_id.to_def_id(), cx.param_env, cx.tables)
-                    .consume_body(body);
+                euv::ExprUseVisitor::new(&mut ctx, &infcx, fn_def_id, cx.param_env, cx.tables).consume_body(body);
             });
             ctx
         };
index 1b21eaeb13ab6fea9412810b622d155e99cb6a49..04b4b42376193c7dd31c1ce552db5bf49888a89e 100644 (file)
@@ -293,7 +293,9 @@ pub fn qpath_res(cx: &LateContext<'_, '_>, qpath: &hir::QPath<'_>, id: hir::HirI
         hir::QPath::Resolved(_, path) => path.res,
         hir::QPath::TypeRelative(..) => {
             if cx.tcx.has_typeck_tables(id.owner.to_def_id()) {
-                cx.tcx.typeck_tables_of(id.owner.to_def_id()).qpath_res(qpath, id)
+                cx.tcx
+                    .typeck_tables_of(id.owner.to_def_id().expect_local())
+                    .qpath_res(qpath, id)
             } else {
                 Res::Err
             }
@@ -436,7 +438,7 @@ pub fn method_chain_args<'a>(expr: &'a Expr<'_>, methods: &[&str]) -> Option<Vec
 pub fn is_entrypoint_fn(cx: &LateContext<'_, '_>, def_id: DefId) -> bool {
     cx.tcx
         .entry_fn(LOCAL_CRATE)
-        .map_or(false, |(entry_fn_def_id, _)| def_id == entry_fn_def_id)
+        .map_or(false, |(entry_fn_def_id, _)| def_id == entry_fn_def_id.to_def_id())
 }
 
 /// Gets the name of the item the expression is in, if available.
index 1838fa5f8ffa4215acae556634c00243a0938e26..c14da6aacea047de74149e8d09921aa20ca1e33f 100644 (file)
@@ -19,7 +19,7 @@ pub fn mutated_variables<'a, 'tcx>(expr: &'tcx Expr<'_>, cx: &'a LateContext<'a,
     };
     let def_id = expr.hir_id.owner.to_def_id();
     cx.tcx.infer_ctxt().enter(|infcx| {
-        ExprUseVisitor::new(&mut delegate, &infcx, def_id, cx.param_env, cx.tables).walk_expr(expr);
+        ExprUseVisitor::new(&mut delegate, &infcx, def_id.expect_local(), cx.param_env, cx.tables).walk_expr(expr);
     });
 
     if delegate.skip {
index 348d13ef41f10b7c9101d29495ac8855e84c6ed3..f3038861cee2431c41795dd5db020f0fcedc16fd 100644 (file)
@@ -85,7 +85,7 @@ fn check_item(&mut self, cx: &LateContext<'_, '_>, item: &Item<'_>) {
             if let ItemKind::Use(use_path, UseKind::Glob) = &item.kind;
             // don't lint prelude glob imports
             if !use_path.segments.iter().last().map_or(false, |ps| ps.ident.as_str() == "prelude");
-            let used_imports = cx.tcx.names_imported_by_glob_use(item.hir_id.owner.to_def_id());
+            let used_imports = cx.tcx.names_imported_by_glob_use(item.hir_id.owner);
             if !used_imports.is_empty(); // Already handled by `unused_imports`
             then {
                 let mut applicability = Applicability::MachineApplicable;