mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Use expect_{use,fn}
in a couple of places
This commit is contained in:
parent
a4aebf030e
commit
b2ef837b6c
@ -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);
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user