From d63e35ba22ae0122e570fdabdb9e8875ef2bbef3 Mon Sep 17 00:00:00 2001 From: GnomedDev Date: Wed, 18 Sep 2024 22:05:02 +0100 Subject: [PATCH] [Clippy] Swap `waker_clone_wake` to use diagnostic item instead of path --- clippy_lints/src/methods/waker_clone_wake.rs | 4 ++-- clippy_utils/src/paths.rs | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/clippy_lints/src/methods/waker_clone_wake.rs b/clippy_lints/src/methods/waker_clone_wake.rs index da66632d55f..9b64cc7589c 100644 --- a/clippy_lints/src/methods/waker_clone_wake.rs +++ b/clippy_lints/src/methods/waker_clone_wake.rs @@ -1,6 +1,6 @@ use clippy_utils::diagnostics::span_lint_and_sugg; use clippy_utils::source::snippet_with_applicability; -use clippy_utils::{is_trait_method, match_def_path, paths}; +use clippy_utils::is_trait_method; use rustc_errors::Applicability; use rustc_hir::{Expr, ExprKind}; use rustc_lint::LateContext; @@ -12,7 +12,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>, recv: &' let ty = cx.typeck_results().expr_ty(recv); if let Some(did) = ty.ty_adt_def() - && match_def_path(cx, did.did(), &paths::WAKER) + && cx.tcx.is_diagnostic_item(sym::Waker, did.did()) && let ExprKind::MethodCall(_, waker_ref, &[], _) = recv.kind && is_trait_method(cx, recv, sym::Clone) { diff --git a/clippy_utils/src/paths.rs b/clippy_utils/src/paths.rs index cb0330d0046..89c1bd8a8a0 100644 --- a/clippy_utils/src/paths.rs +++ b/clippy_utils/src/paths.rs @@ -73,4 +73,3 @@ #[expect(clippy::invalid_paths)] // internal lints do not know about all external crates pub const TOKIO_IO_OPEN_OPTIONS_NEW: [&str; 5] = ["tokio", "fs", "open_options", "OpenOptions", "new"]; pub const INSTANT_NOW: [&str; 4] = ["std", "time", "Instant", "now"]; -pub const WAKER: [&str; 4] = ["core", "task", "wake", "Waker"];