diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2025-03-07 07:29:41 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2025-03-12 09:34:21 +1100 |
| commit | fe04460f6fdc32c0783ca7cab6a0fb73ed254100 (patch) | |
| tree | 12797564946b024d5b0fc5d302b7f2ad801d1942 | |
| parent | 763db5dcd9b95179915e13533af280ad5f6db403 (diff) | |
| download | rust-fe04460f6fdc32c0783ca7cab6a0fb73ed254100.tar.gz rust-fe04460f6fdc32c0783ca7cab6a0fb73ed254100.zip | |
Remove an unnecessary `kw::Empty` check.
Replace it with an assert for now, just in case it is reachable.
| -rw-r--r-- | compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs index c46a42c5de1..61b6f21596e 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs @@ -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 }); |
