Skip to content

Commit fe04460

Browse files
committed
Remove an unnecessary kw::Empty check.
Replace it with an assert for now, just in case it is reachable.
1 parent 763db5d commit fe04460

File tree

1 file changed

+8
-9
lines changed
  • compiler/rustc_hir_typeck/src/fn_ctxt

1 file changed

+8
-9
lines changed

Diff for: compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs

+8-9
Original file line numberDiff line numberDiff line change
@@ -825,15 +825,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
825825

826826
let trait_missing_method =
827827
matches!(error, method::MethodError::NoMatch(_)) && ty.normalized.is_trait();
828-
if item_name.name != kw::Empty {
829-
self.report_method_error(
830-
hir_id,
831-
ty.normalized,
832-
error,
833-
Expectation::NoExpectation,
834-
trait_missing_method && span.edition().at_least_rust_2021(), // emits missing method for trait only after edition 2021
835-
);
836-
}
828+
assert_ne!(item_name.name, kw::Empty);
829+
self.report_method_error(
830+
hir_id,
831+
ty.normalized,
832+
error,
833+
Expectation::NoExpectation,
834+
trait_missing_method && span.edition().at_least_rust_2021(), // emits missing method for trait only after edition 2021
835+
);
837836

838837
result
839838
});

0 commit comments

Comments
 (0)