about summary refs log tree commit diff
path: root/compiler/rustc_lint/src/noop_method_call.rs
diff options
context:
space:
mode:
authorCameron Steffen <cam.steffen94@gmail.com>2021-10-04 16:11:22 -0500
committerCameron Steffen <cam.steffen94@gmail.com>2021-10-06 13:10:08 -0500
commitb6cab80c181e0212966017c0abe1c3e08b50f5d4 (patch)
tree5a1485bbfed98bce9f019f76dc3f14601b5e6316 /compiler/rustc_lint/src/noop_method_call.rs
parent33b9b9530561ada2584c8a9239e6581fef216a2a (diff)
downloadrust-b6cab80c181e0212966017c0abe1c3e08b50f5d4.tar.gz
rust-b6cab80c181e0212966017c0abe1c3e08b50f5d4.zip
Use get_diagnostic_name
Diffstat (limited to 'compiler/rustc_lint/src/noop_method_call.rs')
-rw-r--r--compiler/rustc_lint/src/noop_method_call.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler/rustc_lint/src/noop_method_call.rs b/compiler/rustc_lint/src/noop_method_call.rs
index c14f16b6d11..d2c970468ab 100644
--- a/compiler/rustc_lint/src/noop_method_call.rs
+++ b/compiler/rustc_lint/src/noop_method_call.rs
@@ -51,9 +51,10 @@ impl<'tcx> LateLintPass<'tcx> for NoopMethodCall {
             Some((DefKind::AssocFn, did)) => match cx.tcx.trait_of_item(did) {
                 // Check that we're dealing with a trait method for one of the traits we care about.
                 Some(trait_id)
-                    if [sym::Clone, sym::Deref, sym::Borrow]
-                        .iter()
-                        .any(|s| cx.tcx.is_diagnostic_item(*s, trait_id)) =>
+                    if matches!(
+                        cx.tcx.get_diagnostic_name(trait_id),
+                        Some(sym::Borrow | sym::Clone | sym::Deref)
+                    ) =>
                 {
                     (trait_id, did)
                 }