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());
}
// 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;