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

Commit 959f7a2

Browse files
committed
[Clippy] Swap manual_main_separator_str to use diagnostic item instead of path
1 parent 1922a99 commit 959f7a2

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

clippy_lints/src/manual_main_separator_str.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use clippy_config::msrvs::{self, Msrv};
22
use clippy_config::Conf;
33
use clippy_utils::diagnostics::span_lint_and_sugg;
4-
use clippy_utils::{is_trait_method, match_def_path, paths, peel_hir_expr_refs};
4+
use clippy_utils::{is_trait_method, peel_hir_expr_refs};
55
use rustc_errors::Applicability;
66
use rustc_hir::def::{DefKind, Res};
77
use rustc_hir::{Expr, ExprKind, Mutability, QPath};
@@ -56,7 +56,7 @@ impl LateLintPass<'_> for ManualMainSeparatorStr {
5656
&& let Res::Def(DefKind::Const, receiver_def_id) = path.res
5757
&& is_trait_method(cx, target, sym::ToString)
5858
&& self.msrv.meets(msrvs::PATH_MAIN_SEPARATOR_STR)
59-
&& match_def_path(cx, receiver_def_id, &paths::PATH_MAIN_SEPARATOR)
59+
&& cx.tcx.is_diagnostic_item(sym::path_main_separator, receiver_def_id)
6060
&& let ty::Ref(_, ty, Mutability::Not) = cx.typeck_results().expr_ty_adjusted(expr).kind()
6161
&& ty.is_str()
6262
{

clippy_utils/src/paths.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ pub const OPEN_OPTIONS_NEW: [&str; 4] = ["std", "fs", "OpenOptions", "new"];
4040
pub const PARKING_LOT_MUTEX_GUARD: [&str; 3] = ["lock_api", "mutex", "MutexGuard"];
4141
pub const PARKING_LOT_RWLOCK_READ_GUARD: [&str; 3] = ["lock_api", "rwlock", "RwLockReadGuard"];
4242
pub const PARKING_LOT_RWLOCK_WRITE_GUARD: [&str; 3] = ["lock_api", "rwlock", "RwLockWriteGuard"];
43-
pub const PATH_MAIN_SEPARATOR: [&str; 3] = ["std", "path", "MAIN_SEPARATOR"];
4443
#[cfg_attr(not(unix), allow(clippy::invalid_paths))]
4544
pub const PERMISSIONS_FROM_MODE: [&str; 6] = ["std", "os", "unix", "fs", "PermissionsExt", "from_mode"];
4645
pub const PUSH_STR: [&str; 4] = ["alloc", "string", "String", "push_str"];

0 commit comments

Comments
 (0)