about summary refs log tree commit diff
path: root/compiler/rustc_lint/src/noop_method_call.rs
diff options
context:
space:
mode:
authorRyan Levick <ryan.levick@gmail.com>2021-01-05 16:46:50 +0100
committerRyan Levick <me@ryanlevick.com>2021-03-03 11:22:44 +0100
commita6d926d80db4a52398dea0cf29e6c501eab50170 (patch)
tree78b945cf6fc47e5dd60f9891380dd45927505f2f /compiler/rustc_lint/src/noop_method_call.rs
parentf49ed7a6b7aa3a44dd0444b508a1d0ddc09b0f15 (diff)
downloadrust-a6d926d80db4a52398dea0cf29e6c501eab50170.tar.gz
rust-a6d926d80db4a52398dea0cf29e6c501eab50170.zip
Fix tests
Diffstat (limited to 'compiler/rustc_lint/src/noop_method_call.rs')
-rw-r--r--compiler/rustc_lint/src/noop_method_call.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/rustc_lint/src/noop_method_call.rs b/compiler/rustc_lint/src/noop_method_call.rs
index 3ab3fab4272..dad557128f8 100644
--- a/compiler/rustc_lint/src/noop_method_call.rs
+++ b/compiler/rustc_lint/src/noop_method_call.rs
@@ -46,6 +46,14 @@ impl<'tcx> LateLintPass<'tcx> for NoopMethodCall {
             {
                 // Check that we're dealing with a trait method
                 if let Some(trait_id) = cx.tcx.trait_of_item(did) {
+                    // Check we're dealing with one of the traits we care about
+                    if ![sym::Clone, sym::Deref, sym::Borrow]
+                        .iter()
+                        .any(|s| cx.tcx.is_diagnostic_item(*s, trait_id))
+                    {
+                        return;
+                    }
+
                     let substs = cx.typeck_results().node_substs(expr.hir_id);
                     // We can't resolve on types that recursively require monomorphization,
                     // so check that we don't need to perfom substitution
@@ -54,7 +62,6 @@ impl<'tcx> LateLintPass<'tcx> for NoopMethodCall {
                         // Resolve the trait method instance
                         if let Ok(Some(i)) = ty::Instance::resolve(cx.tcx, param_env, did, substs) {
                             // Check that it implements the noop diagnostic
-                            tracing::debug!("Resolves to: {:?}", i.def_id());
                             if [
                                 sym::noop_method_borrow,
                                 sym::noop_method_clone,