]> git.proxmox.com Git - rustc.git/blobdiff - compiler/rustc_typeck/src/check_unused.rs
New upstream version 1.56.0~beta.4+dfsg1
[rustc.git] / compiler / rustc_typeck / src / check_unused.rs
index 7e5cc771b3199a20ee75774b7f6f53a2858f916d..cb127880c62b315c41ee3bb6547ef463cd1358a4 100644 (file)
@@ -9,8 +9,7 @@ use rustc_span::{Span, Symbol};
 
 pub fn check_crate(tcx: TyCtxt<'_>) {
     let mut used_trait_imports = FxHashSet::default();
-    for &body_id in tcx.hir().krate().bodies.keys() {
-        let item_def_id = tcx.hir().body_owner_def_id(body_id);
+    for item_def_id in tcx.body_owners() {
         let imports = tcx.used_trait_imports(item_def_id);
         debug!("GatherVisitor: item_def_id={:?} with imports {:#?}", item_def_id, imports);
         used_trait_imports.extend(imports.iter());
@@ -155,7 +154,7 @@ fn unused_crates_lint(tcx: TyCtxt<'_>) {
         }
 
         // If the extern crate isn't in the extern prelude,
-        // there is no way it can be written as an `use`.
+        // there is no way it can be written as a `use`.
         let orig_name = extern_crate.orig_name.unwrap_or(item.ident.name);
         if !extern_prelude.get(&orig_name).map_or(false, |from_item| !from_item) {
             continue;