1
Fork 0

Remove an unnecessary kw::Empty check.

Replace it with an assert for now, just in case it is reachable.
This commit is contained in:
Nicholas Nethercote 2025-03-07 07:29:41 +11:00
parent 763db5dcd9
commit fe04460f6f

View file

@ -825,15 +825,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
let trait_missing_method =
matches!(error, method::MethodError::NoMatch(_)) && ty.normalized.is_trait();
if item_name.name != kw::Empty {
self.report_method_error(
hir_id,
ty.normalized,
error,
Expectation::NoExpectation,
trait_missing_method && span.edition().at_least_rust_2021(), // emits missing method for trait only after edition 2021
);
}
assert_ne!(item_name.name, kw::Empty);
self.report_method_error(
hir_id,
ty.normalized,
error,
Expectation::NoExpectation,
trait_missing_method && span.edition().at_least_rust_2021(), // emits missing method for trait only after edition 2021
);
result
});