[Clippy] Swap non_octal_unix_permissions
to use diagnostic item instead of path
This commit is contained in:
parent
f1fc9c07c4
commit
37e38320b4
@ -1,6 +1,5 @@
|
|||||||
use clippy_utils::diagnostics::span_lint_and_sugg;
|
use clippy_utils::diagnostics::span_lint_and_sugg;
|
||||||
use clippy_utils::source::{snippet_with_applicability, SpanRangeExt};
|
use clippy_utils::source::{snippet_with_applicability, SpanRangeExt};
|
||||||
use clippy_utils::{match_def_path, paths};
|
|
||||||
use rustc_errors::Applicability;
|
use rustc_errors::Applicability;
|
||||||
use rustc_hir::{Expr, ExprKind};
|
use rustc_hir::{Expr, ExprKind};
|
||||||
use rustc_lint::{LateContext, LateLintPass};
|
use rustc_lint::{LateContext, LateLintPass};
|
||||||
@ -63,7 +62,7 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) {
|
|||||||
ExprKind::Call(func, [param]) => {
|
ExprKind::Call(func, [param]) => {
|
||||||
if let ExprKind::Path(ref path) = func.kind
|
if let ExprKind::Path(ref path) = func.kind
|
||||||
&& let Some(def_id) = cx.qpath_res(path, func.hir_id).opt_def_id()
|
&& let Some(def_id) = cx.qpath_res(path, func.hir_id).opt_def_id()
|
||||||
&& match_def_path(cx, def_id, &paths::PERMISSIONS_FROM_MODE)
|
&& cx.tcx.is_diagnostic_item(sym::permissions_from_mode, def_id)
|
||||||
&& let ExprKind::Lit(_) = param.kind
|
&& let ExprKind::Lit(_) = param.kind
|
||||||
&& param.span.eq_ctxt(expr.span)
|
&& param.span.eq_ctxt(expr.span)
|
||||||
&& param
|
&& param
|
||||||
|
@ -39,8 +39,6 @@
|
|||||||
pub const PARKING_LOT_MUTEX_GUARD: [&str; 3] = ["lock_api", "mutex", "MutexGuard"];
|
pub const PARKING_LOT_MUTEX_GUARD: [&str; 3] = ["lock_api", "mutex", "MutexGuard"];
|
||||||
pub const PARKING_LOT_RWLOCK_READ_GUARD: [&str; 3] = ["lock_api", "rwlock", "RwLockReadGuard"];
|
pub const PARKING_LOT_RWLOCK_READ_GUARD: [&str; 3] = ["lock_api", "rwlock", "RwLockReadGuard"];
|
||||||
pub const PARKING_LOT_RWLOCK_WRITE_GUARD: [&str; 3] = ["lock_api", "rwlock", "RwLockWriteGuard"];
|
pub const PARKING_LOT_RWLOCK_WRITE_GUARD: [&str; 3] = ["lock_api", "rwlock", "RwLockWriteGuard"];
|
||||||
#[cfg_attr(not(unix), allow(clippy::invalid_paths))]
|
|
||||||
pub const PERMISSIONS_FROM_MODE: [&str; 6] = ["std", "os", "unix", "fs", "PermissionsExt", "from_mode"];
|
|
||||||
pub const REGEX_BUILDER_NEW: [&str; 3] = ["regex", "RegexBuilder", "new"];
|
pub const REGEX_BUILDER_NEW: [&str; 3] = ["regex", "RegexBuilder", "new"];
|
||||||
pub const REGEX_BYTES_BUILDER_NEW: [&str; 4] = ["regex", "bytes", "RegexBuilder", "new"];
|
pub const REGEX_BYTES_BUILDER_NEW: [&str; 4] = ["regex", "bytes", "RegexBuilder", "new"];
|
||||||
pub const REGEX_BYTES_NEW: [&str; 4] = ["regex", "bytes", "Regex", "new"];
|
pub const REGEX_BYTES_NEW: [&str; 4] = ["regex", "bytes", "Regex", "new"];
|
||||||
|
Loading…
Reference in New Issue
Block a user