Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit d63e35b

Browse files
committed
[Clippy] Swap waker_clone_wake to use diagnostic item instead of path
1 parent 45c1700 commit d63e35b

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

clippy_lints/src/methods/waker_clone_wake.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use clippy_utils::diagnostics::span_lint_and_sugg;
22
use clippy_utils::source::snippet_with_applicability;
3-
use clippy_utils::{is_trait_method, match_def_path, paths};
3+
use clippy_utils::is_trait_method;
44
use rustc_errors::Applicability;
55
use rustc_hir::{Expr, ExprKind};
66
use rustc_lint::LateContext;
@@ -12,7 +12,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>, recv: &'
1212
let ty = cx.typeck_results().expr_ty(recv);
1313

1414
if let Some(did) = ty.ty_adt_def()
15-
&& match_def_path(cx, did.did(), &paths::WAKER)
15+
&& cx.tcx.is_diagnostic_item(sym::Waker, did.did())
1616
&& let ExprKind::MethodCall(_, waker_ref, &[], _) = recv.kind
1717
&& is_trait_method(cx, recv, sym::Clone)
1818
{

clippy_utils/src/paths.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,3 @@ pub const TOKIO_IO_OPEN_OPTIONS: [&str; 4] = ["tokio", "fs", "open_options", "Op
7373
#[expect(clippy::invalid_paths)] // internal lints do not know about all external crates
7474
pub const TOKIO_IO_OPEN_OPTIONS_NEW: [&str; 5] = ["tokio", "fs", "open_options", "OpenOptions", "new"];
7575
pub const INSTANT_NOW: [&str; 4] = ["std", "time", "Instant", "now"];
76-
pub const WAKER: [&str; 4] = ["core", "task", "wake", "Waker"];

0 commit comments

Comments
 (0)