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

Commit 98dc68e

Browse files
committed
[Clippy] Swap instant_subtraction to use diagnostic item instead of path
1 parent d63e35b commit 98dc68e

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

clippy_lints/src/instant_subtraction.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ impl LateLintPass<'_> for InstantSubtraction {
112112
fn is_instant_now_call(cx: &LateContext<'_>, expr_block: &'_ Expr<'_>) -> bool {
113113
if let ExprKind::Call(fn_expr, []) = expr_block.kind
114114
&& let Some(fn_id) = clippy_utils::path_def_id(cx, fn_expr)
115-
&& clippy_utils::match_def_path(cx, fn_id, &clippy_utils::paths::INSTANT_NOW)
115+
&& cx.tcx.is_diagnostic_item(sym::instant_now, fn_id)
116116
{
117117
true
118118
} else {

clippy_utils/src/paths.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,3 @@ pub const TOKIO_IO_ASYNCWRITEEXT: [&str; 5] = ["tokio", "io", "util", "async_wri
7272
pub const TOKIO_IO_OPEN_OPTIONS: [&str; 4] = ["tokio", "fs", "open_options", "OpenOptions"];
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"];
75-
pub const INSTANT_NOW: [&str; 4] = ["std", "time", "Instant", "now"];

0 commit comments

Comments
 (0)