about summary refs log tree commit diff
path: root/compiler/rustc_lint/src
diff options
context:
space:
mode:
authorJason Newcomb <jsnewcomb@pm.me>2023-09-27 11:01:41 -0400
committerJason Newcomb <jsnewcomb@pm.me>2023-09-28 08:22:59 -0400
commit66bc682caba7d7c2ea68764e885b337e7610362e (patch)
treef3b4b5c9f571b950923a12ee49afed163aec6412 /compiler/rustc_lint/src
parent92009f217a05d12716e278b4ade8d2624946eb5f (diff)
downloadrust-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.rs6
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);