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

Commit 71dbfd5

Browse files
committed
[Clippy] Swap lines_filter_map_ok to use a diagnostic item instead of path
1 parent 5a13a93 commit 71dbfd5

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

clippy_lints/src/lines_filter_map_ok.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_then;
22
use clippy_utils::ty::is_type_diagnostic_item;
3-
use clippy_utils::{is_diag_item_method, is_trait_method, match_def_path, path_to_local_id, paths};
3+
use clippy_utils::{is_diag_item_method, is_trait_method, path_to_local_id};
44
use rustc_errors::Applicability;
55
use rustc_hir::{Body, Closure, Expr, ExprKind};
66
use rustc_lint::{LateContext, LateLintPass};
@@ -96,7 +96,7 @@ fn should_lint(cx: &LateContext<'_>, args: &[Expr<'_>], method_str: &str) -> boo
9696
ExprKind::Path(qpath) => cx
9797
.qpath_res(qpath, fm_arg.hir_id)
9898
.opt_def_id()
99-
.is_some_and(|did| match_def_path(cx, did, &paths::CORE_RESULT_OK_METHOD)),
99+
.is_some_and(|did| cx.tcx.is_diagnostic_item(sym::result_ok_method, did)),
100100
// Detect `|x| x.ok()`
101101
ExprKind::Closure(Closure { body, .. }) => {
102102
if let Body {

clippy_utils/src/paths.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ pub const APPLICABILITY_VALUES: [[&str; 3]; 4] = [
1212
["rustc_lint_defs", "Applicability", "MachineApplicable"],
1313
];
1414
pub const DIAG: [&str; 2] = ["rustc_errors", "Diag"];
15-
pub const CORE_RESULT_OK_METHOD: [&str; 4] = ["core", "result", "Result", "ok"];
1615
pub const CSTRING_AS_C_STR: [&str; 5] = ["alloc", "ffi", "c_str", "CString", "as_c_str"];
1716
pub const EARLY_CONTEXT: [&str; 2] = ["rustc_lint", "EarlyContext"];
1817
pub const EARLY_LINT_PASS: [&str; 3] = ["rustc_lint", "passes", "EarlyLintPass"];

0 commit comments

Comments
 (0)