X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_hir_analysis%2Fsrc%2Fcheck_unused.rs;h=5716be4f1a95445c5f4db941b7c89123f440c13b;hb=dc3e59cb3fe05ebd752d3a2269f501c00327be22;hp=5749b04783ce4ff8c7608e83771a3754471fffe4;hpb=01c75848eb94e96210e74b8dd43a5a270464ac25;p=rust.git diff --git a/compiler/rustc_hir_analysis/src/check_unused.rs b/compiler/rustc_hir_analysis/src/check_unused.rs index 5749b04783c..5716be4f1a9 100644 --- a/compiler/rustc_hir_analysis/src/check_unused.rs +++ b/compiler/rustc_hir_analysis/src/check_unused.rs @@ -29,7 +29,7 @@ pub fn check_crate(tcx: TyCtxt<'_>) { if item.span.is_dummy() { continue; } - let hir::ItemKind::Use(path, _) = item.kind else { unreachable!() }; + let (path, _) = item.expect_use(); let msg = if let Ok(snippet) = tcx.sess.source_map().span_to_snippet(path.span) { format!("unused import: `{}`", snippet) } else { @@ -50,7 +50,7 @@ pub fn check_crate(tcx: TyCtxt<'_>) { fn unused_crates_lint(tcx: TyCtxt<'_>) { let lint = lint::builtin::UNUSED_EXTERN_CRATES; - // Collect first the crates that are completely unused. These we + // Collect first the crates that are completely unused. These we // can always suggest removing (no matter which edition we are // in). let unused_extern_crates: FxHashMap = tcx