diff options
| author | Jason Newcomb <jsnewcomb@pm.me> | 2023-09-27 11:01:41 -0400 |
|---|---|---|
| committer | Jason Newcomb <jsnewcomb@pm.me> | 2023-09-28 08:22:59 -0400 |
| commit | 66bc682caba7d7c2ea68764e885b337e7610362e (patch) | |
| tree | f3b4b5c9f571b950923a12ee49afed163aec6412 /compiler/rustc_lint/src | |
| parent | 92009f217a05d12716e278b4ade8d2624946eb5f (diff) | |
| download | rust-66bc682caba7d7c2ea68764e885b337e7610362e.tar.gz rust-66bc682caba7d7c2ea68764e885b337e7610362e.zip | |
Fix `noop_method_call` detection for new diagnostic items
Diffstat (limited to 'compiler/rustc_lint/src')
| -rw-r--r-- | compiler/rustc_lint/src/noop_method_call.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/rustc_lint/src/noop_method_call.rs b/compiler/rustc_lint/src/noop_method_call.rs index bc0b9d6d818..cfbca6efbfa 100644 --- a/compiler/rustc_lint/src/noop_method_call.rs +++ b/compiler/rustc_lint/src/noop_method_call.rs @@ -98,6 +98,12 @@ impl<'tcx> LateLintPass<'tcx> for NoopMethodCall { let Ok(Some(i)) = ty::Instance::resolve(cx.tcx, cx.param_env, did, args) else { return }; // (Re)check that it implements the noop diagnostic. let Some(name) = cx.tcx.get_diagnostic_name(i.def_id()) else { return }; + if !matches!( + name, + sym::noop_method_borrow | sym::noop_method_clone | sym::noop_method_deref + ) { + return; + } let receiver_ty = cx.typeck_results().expr_ty(receiver); let expr_ty = cx.typeck_results().expr_ty_adjusted(expr); |
