Dogfood
This commit is contained in:
parent
2be695bf29
commit
6384221910
@ -1,6 +1,6 @@
|
|||||||
use clippy_utils::{
|
use clippy_utils::{
|
||||||
diagnostics::span_lint_and_then,
|
diagnostics::span_lint_and_then,
|
||||||
expr_or_init, get_attr, match_def_path, path_to_local, paths,
|
expr_or_init, get_attr, path_to_local,
|
||||||
source::{indent_of, snippet},
|
source::{indent_of, snippet},
|
||||||
};
|
};
|
||||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap};
|
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap};
|
||||||
@ -13,6 +13,7 @@
|
|||||||
use rustc_lint::{LateContext, LateLintPass, LintContext};
|
use rustc_lint::{LateContext, LateLintPass, LintContext};
|
||||||
use rustc_middle::ty::{subst::GenericArgKind, Ty, TypeAndMut};
|
use rustc_middle::ty::{subst::GenericArgKind, Ty, TypeAndMut};
|
||||||
use rustc_session::{declare_tool_lint, impl_lint_pass};
|
use rustc_session::{declare_tool_lint, impl_lint_pass};
|
||||||
|
use rustc_span::sym;
|
||||||
use rustc_span::{symbol::Ident, Span, DUMMY_SP};
|
use rustc_span::{symbol::Ident, Span, DUMMY_SP};
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
|
||||||
@ -435,7 +436,7 @@ fn has_drop(expr: &hir::Expr<'_>, first_bind_ident: &Ident, lcx: &LateContext<'_
|
|||||||
if let hir::ExprKind::Call(fun, args) = expr.kind
|
if let hir::ExprKind::Call(fun, args) = expr.kind
|
||||||
&& let hir::ExprKind::Path(hir::QPath::Resolved(_, fun_path)) = &fun.kind
|
&& let hir::ExprKind::Path(hir::QPath::Resolved(_, fun_path)) = &fun.kind
|
||||||
&& let Res::Def(DefKind::Fn, did) = fun_path.res
|
&& let Res::Def(DefKind::Fn, did) = fun_path.res
|
||||||
&& match_def_path(lcx, did, &paths::DROP)
|
&& lcx.tcx.is_diagnostic_item(sym::mem_drop, did)
|
||||||
&& let [first_arg, ..] = args
|
&& let [first_arg, ..] = args
|
||||||
&& let hir::ExprKind::Path(hir::QPath::Resolved(_, arg_path)) = &first_arg.kind
|
&& let hir::ExprKind::Path(hir::QPath::Resolved(_, arg_path)) = &first_arg.kind
|
||||||
&& let [first_arg_ps, .. ] = arg_path.segments
|
&& let [first_arg_ps, .. ] = arg_path.segments
|
||||||
|
@ -57,7 +57,6 @@
|
|||||||
pub const LATE_LINT_PASS: [&str; 3] = ["rustc_lint", "passes", "LateLintPass"];
|
pub const LATE_LINT_PASS: [&str; 3] = ["rustc_lint", "passes", "LateLintPass"];
|
||||||
#[cfg(feature = "internal")]
|
#[cfg(feature = "internal")]
|
||||||
pub const LINT: [&str; 2] = ["rustc_lint_defs", "Lint"];
|
pub const LINT: [&str; 2] = ["rustc_lint_defs", "Lint"];
|
||||||
pub const DROP: [&str; 3] = ["core", "mem", "drop"];
|
|
||||||
pub const MEM_SWAP: [&str; 3] = ["core", "mem", "swap"];
|
pub const MEM_SWAP: [&str; 3] = ["core", "mem", "swap"];
|
||||||
#[cfg(feature = "internal")]
|
#[cfg(feature = "internal")]
|
||||||
pub const MSRV: [&str; 3] = ["clippy_utils", "msrvs", "Msrv"];
|
pub const MSRV: [&str; 3] = ["clippy_utils", "msrvs", "Msrv"];
|
||||||
|
Loading…
Reference in New Issue
Block a user