Use expect_{use,fn} in a couple of places

This commit is contained in:
Maybe Waffle 2023-01-30 05:50:37 +00:00
parent a4aebf030e
commit b2ef837b6c
2 changed files with 2 additions and 2 deletions

View File

@ -1504,7 +1504,7 @@ fn compare_synthetic_generics<'tcx>(
let _: Option<_> = try {
let impl_m = impl_m.def_id.as_local()?;
let impl_m = tcx.hir().expect_impl_item(impl_m);
let hir::ImplItemKind::Fn(sig, _) = &impl_m.kind else { unreachable!() };
let (sig, _) = impl_m.expect_fn();
let input_tys = sig.decl.inputs;
struct Visitor(Option<Span>, hir::def_id::LocalDefId);

View File

@ -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 {