Skip to content

Commit b2ef837

Browse files
committed
Use expect_{use,fn} in a couple of places
1 parent a4aebf0 commit b2ef837

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

compiler/rustc_hir_analysis/src/check/compare_impl_item.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1504,7 +1504,7 @@ fn compare_synthetic_generics<'tcx>(
15041504
let _: Option<_> = try {
15051505
let impl_m = impl_m.def_id.as_local()?;
15061506
let impl_m = tcx.hir().expect_impl_item(impl_m);
1507-
let hir::ImplItemKind::Fn(sig, _) = &impl_m.kind else { unreachable!() };
1507+
let (sig, _) = impl_m.expect_fn();
15081508
let input_tys = sig.decl.inputs;
15091509

15101510
struct Visitor(Option<Span>, hir::def_id::LocalDefId);

compiler/rustc_hir_analysis/src/check_unused.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub fn check_crate(tcx: TyCtxt<'_>) {
2929
if item.span.is_dummy() {
3030
continue;
3131
}
32-
let hir::ItemKind::Use(path, _) = item.kind else { unreachable!() };
32+
let (path, _) = item.expect_use();
3333
let msg = if let Ok(snippet) = tcx.sess.source_map().span_to_snippet(path.span) {
3434
format!("unused import: `{}`", snippet)
3535
} else {

0 commit comments

Comments
 (0)