Use expect_{use,fn}
in a couple of places
This commit is contained in:
parent
a4aebf030e
commit
b2ef837b6c
2 changed files with 2 additions and 2 deletions
|
@ -1504,7 +1504,7 @@ fn compare_synthetic_generics<'tcx>(
|
||||||
let _: Option<_> = try {
|
let _: Option<_> = try {
|
||||||
let impl_m = impl_m.def_id.as_local()?;
|
let impl_m = impl_m.def_id.as_local()?;
|
||||||
let impl_m = tcx.hir().expect_impl_item(impl_m);
|
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;
|
let input_tys = sig.decl.inputs;
|
||||||
|
|
||||||
struct Visitor(Option<Span>, hir::def_id::LocalDefId);
|
struct Visitor(Option<Span>, hir::def_id::LocalDefId);
|
||||||
|
|
|
@ -29,7 +29,7 @@ pub fn check_crate(tcx: TyCtxt<'_>) {
|
||||||
if item.span.is_dummy() {
|
if item.span.is_dummy() {
|
||||||
continue;
|
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) {
|
let msg = if let Ok(snippet) = tcx.sess.source_map().span_to_snippet(path.span) {
|
||||||
format!("unused import: `{}`", snippet)
|
format!("unused import: `{}`", snippet)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue