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

Commit 37e3832

Browse files
committed
[Clippy] Swap non_octal_unix_permissions to use diagnostic item instead of path
1 parent f1fc9c0 commit 37e3832

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

clippy_lints/src/non_octal_unix_permissions.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use clippy_utils::diagnostics::span_lint_and_sugg;
22
use clippy_utils::source::{snippet_with_applicability, SpanRangeExt};
3-
use clippy_utils::{match_def_path, paths};
43
use rustc_errors::Applicability;
54
use rustc_hir::{Expr, ExprKind};
65
use rustc_lint::{LateContext, LateLintPass};
@@ -63,7 +62,7 @@ impl<'tcx> LateLintPass<'tcx> for NonOctalUnixPermissions {
6362
ExprKind::Call(func, [param]) => {
6463
if let ExprKind::Path(ref path) = func.kind
6564
&& let Some(def_id) = cx.qpath_res(path, func.hir_id).opt_def_id()
66-
&& match_def_path(cx, def_id, &paths::PERMISSIONS_FROM_MODE)
65+
&& cx.tcx.is_diagnostic_item(sym::permissions_from_mode, def_id)
6766
&& let ExprKind::Lit(_) = param.kind
6867
&& param.span.eq_ctxt(expr.span)
6968
&& param

clippy_utils/src/paths.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ pub const OPEN_OPTIONS_NEW: [&str; 4] = ["std", "fs", "OpenOptions", "new"];
3939
pub const PARKING_LOT_MUTEX_GUARD: [&str; 3] = ["lock_api", "mutex", "MutexGuard"];
4040
pub const PARKING_LOT_RWLOCK_READ_GUARD: [&str; 3] = ["lock_api", "rwlock", "RwLockReadGuard"];
4141
pub const PARKING_LOT_RWLOCK_WRITE_GUARD: [&str; 3] = ["lock_api", "rwlock", "RwLockWriteGuard"];
42-
#[cfg_attr(not(unix), allow(clippy::invalid_paths))]
43-
pub const PERMISSIONS_FROM_MODE: [&str; 6] = ["std", "os", "unix", "fs", "PermissionsExt", "from_mode"];
4442
pub const REGEX_BUILDER_NEW: [&str; 3] = ["regex", "RegexBuilder", "new"];
4543
pub const REGEX_BYTES_BUILDER_NEW: [&str; 4] = ["regex", "bytes", "RegexBuilder", "new"];
4644
pub const REGEX_BYTES_NEW: [&str; 4] = ["regex", "bytes", "Regex", "new"];

0 commit comments

Comments
 (0)