Remove is_path_diagnostic_item
This commit is contained in:
parent
d32ef64ed5
commit
cb32444ee6
18 changed files with 47 additions and 48 deletions
|
|
@ -1,6 +1,7 @@
|
|||
use clippy_utils::diagnostics::span_lint_and_sugg;
|
||||
use clippy_utils::res::{MaybeDef, MaybeResPath};
|
||||
use clippy_utils::source::SpanRangeExt;
|
||||
use clippy_utils::{expr_or_init, is_path_diagnostic_item, std_or_core, sym};
|
||||
use clippy_utils::{expr_or_init, std_or_core, sym};
|
||||
use rustc_ast::LitKind;
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_hir::{Expr, ExprKind, GenericArg, Mutability, QPath, Ty, TyKind};
|
||||
|
|
@ -53,7 +54,7 @@ fn is_expr_const_aligned(cx: &LateContext<'_>, expr: &Expr<'_>, to: &Ty<'_>) ->
|
|||
|
||||
fn is_align_of_call(cx: &LateContext<'_>, fun: &Expr<'_>, to: &Ty<'_>) -> bool {
|
||||
if let ExprKind::Path(QPath::Resolved(_, path)) = fun.kind
|
||||
&& is_path_diagnostic_item(cx, fun, sym::mem_align_of)
|
||||
&& fun.basic_res().is_diag_item(cx, sym::mem_align_of)
|
||||
&& let Some(args) = path.segments.last().and_then(|seg| seg.args)
|
||||
&& let [GenericArg::Type(generic_ty)] = args.args
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
use clippy_config::Conf;
|
||||
use clippy_utils::diagnostics::{span_lint, span_lint_and_sugg};
|
||||
use clippy_utils::msrvs::Msrv;
|
||||
use clippy_utils::res::{MaybeDef, MaybeQPath, MaybeResPath};
|
||||
use clippy_utils::{is_none_pattern, msrvs, peel_hir_expr_refs, sym};
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_hir::def::{DefKind, Res};
|
||||
|
|
@ -189,7 +190,7 @@ fn check_arms(cx: &LateContext<'_>, none_arm: &Arm<'_>, some_arm: &Arm<'_>) -> b
|
|||
|
||||
fn returns_empty_slice(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
|
||||
match expr.kind {
|
||||
ExprKind::Path(_) => clippy_utils::is_path_diagnostic_item(cx, expr, sym::default_fn),
|
||||
ExprKind::Path(_) => expr.res(cx).is_diag_item(cx, sym::default_fn),
|
||||
ExprKind::Closure(cl) => is_empty_slice(cx, cx.tcx.hir_body(cl.body).value),
|
||||
_ => false,
|
||||
}
|
||||
|
|
@ -214,11 +215,11 @@ fn is_empty_slice(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
|
|||
_ => false,
|
||||
},
|
||||
ExprKind::Array([]) => true,
|
||||
ExprKind::Call(def, []) => clippy_utils::is_path_diagnostic_item(cx, def, sym::default_fn),
|
||||
ExprKind::Call(def, []) => def.res(cx).is_diag_item(cx, sym::default_fn),
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
fn is_slice_from_ref(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
|
||||
clippy_utils::is_path_diagnostic_item(cx, expr, sym::slice_from_ref)
|
||||
expr.basic_res().is_diag_item(cx, sym::slice_from_ref)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
use std::fmt::Write as _;
|
||||
|
||||
use clippy_utils::diagnostics::span_lint_and_sugg;
|
||||
use clippy_utils::res::{MaybeDef, MaybeQPath};
|
||||
use clippy_utils::source::snippet_with_applicability;
|
||||
use clippy_utils::sugg;
|
||||
use clippy_utils::ty::implements_trait;
|
||||
use clippy_utils::{is_path_diagnostic_item, sugg};
|
||||
use rustc_ast::join_path_idents;
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_hir::def::Res;
|
||||
|
|
@ -15,7 +16,7 @@ use rustc_span::sym;
|
|||
use super::FROM_ITER_INSTEAD_OF_COLLECT;
|
||||
|
||||
pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, args: &[Expr<'_>], func: &Expr<'_>) {
|
||||
if is_path_diagnostic_item(cx, func, sym::from_iter_fn)
|
||||
if func.res(cx).is_diag_item(cx, sym::from_iter_fn)
|
||||
&& let arg_ty = cx.typeck_results().expr_ty(&args[0])
|
||||
&& let Some(iter_id) = cx.tcx.get_diagnostic_item(sym::Iterator)
|
||||
&& implements_trait(cx, arg_ty, iter_id, &[])
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
use clippy_utils::diagnostics::span_lint_and_then;
|
||||
use clippy_utils::msrvs::{self, Msrv};
|
||||
use clippy_utils::{expr_or_init, is_path_diagnostic_item, sym};
|
||||
use clippy_utils::res::{MaybeDef, MaybeQPath};
|
||||
use clippy_utils::{expr_or_init, sym};
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_hir::{Expr, ExprKind, QPath};
|
||||
use rustc_lint::LateContext;
|
||||
|
|
@ -10,7 +11,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, path: &Expr<'_>, args
|
|||
&& !expr.span.from_expansion()
|
||||
&& !error_kind.span.from_expansion()
|
||||
&& let ExprKind::Path(QPath::TypeRelative(_, new_segment)) = path.kind
|
||||
&& is_path_diagnostic_item(cx, path, sym::io_error_new)
|
||||
&& path.ty_rel_def(cx).is_diag_item(cx, sym::io_error_new)
|
||||
&& let ExprKind::Path(QPath::Resolved(_, init_path)) = &expr_or_init(cx, error_kind).kind
|
||||
&& let [.., error_kind_ty, error_kind_variant] = init_path.segments
|
||||
&& cx.tcx.is_diagnostic_item(sym::io_errorkind, error_kind_ty.res.def_id())
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use clippy_utils::diagnostics::span_lint_and_sugg;
|
||||
use clippy_utils::is_path_diagnostic_item;
|
||||
use clippy_utils::res::{MaybeDef, MaybeResPath};
|
||||
use clippy_utils::source::{snippet_with_applicability, snippet_with_context};
|
||||
use clippy_utils::sugg::Sugg;
|
||||
use clippy_utils::ty::{is_type_diagnostic_item, is_type_lang_item};
|
||||
|
|
@ -55,7 +55,7 @@ pub(super) fn check(
|
|||
take_arg: &Expr<'_>,
|
||||
) {
|
||||
if let ExprKind::Call(repeat_fn, [repeat_arg]) = take_self_arg.kind
|
||||
&& is_path_diagnostic_item(cx, repeat_fn, sym::iter_repeat)
|
||||
&& repeat_fn.basic_res().is_diag_item(cx, sym::iter_repeat)
|
||||
&& is_type_lang_item(cx, cx.typeck_results().expr_ty(collect_expr), LangItem::String)
|
||||
&& let Some(take_id) = cx.typeck_results().type_dependent_def_id(take_expr.hir_id)
|
||||
&& let Some(iter_trait_id) = cx.tcx.get_diagnostic_item(sym::Iterator)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
use clippy_utils::res::{MaybeDef, MaybeQPath};
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_hir::{Closure, Expr, ExprKind, HirId, StmtKind, UnOp};
|
||||
use rustc_lint::LateContext;
|
||||
|
|
@ -8,7 +9,7 @@ use super::NEEDLESS_CHARACTER_ITERATION;
|
|||
use super::utils::get_last_chain_binding_hir_id;
|
||||
use clippy_utils::diagnostics::span_lint_and_sugg;
|
||||
use clippy_utils::source::SpanRangeExt;
|
||||
use clippy_utils::{is_path_diagnostic_item, path_to_local_id, peel_blocks, sym};
|
||||
use clippy_utils::{path_to_local_id, peel_blocks, sym};
|
||||
|
||||
fn peels_expr_ref<'a, 'tcx>(mut expr: &'a Expr<'tcx>) -> &'a Expr<'tcx> {
|
||||
while let ExprKind::AddrOf(_, _, e) = expr.kind {
|
||||
|
|
@ -75,7 +76,7 @@ fn handle_expr(
|
|||
// If we have `!is_ascii`, then only `.any()` should warn. And if the condition is
|
||||
// `is_ascii`, then only `.all()` should warn.
|
||||
if revert != is_all
|
||||
&& is_path_diagnostic_item(cx, fn_path, sym::char_is_ascii)
|
||||
&& fn_path.ty_rel_def(cx).is_diag_item(cx, sym::char_is_ascii)
|
||||
&& path_to_local_id(peels_expr_ref(arg), first_param)
|
||||
&& let Some(snippet) = before_chars.get_source_text(cx)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use clippy_utils::diagnostics::span_lint;
|
||||
use clippy_utils::is_path_diagnostic_item;
|
||||
use clippy_utils::res::{MaybeDef, MaybeQPath};
|
||||
use clippy_utils::ty::is_uninit_value_valid_for_ty;
|
||||
use rustc_hir as hir;
|
||||
use rustc_lint::LateContext;
|
||||
|
|
@ -10,7 +10,7 @@ use super::UNINIT_ASSUMED_INIT;
|
|||
/// lint for `MaybeUninit::uninit().assume_init()` (we already have the latter)
|
||||
pub(super) fn check(cx: &LateContext<'_>, expr: &hir::Expr<'_>, recv: &hir::Expr<'_>) {
|
||||
if let hir::ExprKind::Call(callee, []) = recv.kind
|
||||
&& is_path_diagnostic_item(cx, callee, sym::maybe_uninit_uninit)
|
||||
&& callee.ty_rel_def(cx).is_diag_item(cx, sym::maybe_uninit_uninit)
|
||||
&& !is_uninit_value_valid_for_ty(cx, cx.typeck_results().expr_ty_adjusted(expr))
|
||||
{
|
||||
span_lint(
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
use clippy_utils::diagnostics::span_lint_and_sugg;
|
||||
use clippy_utils::macros::matching_root_macro_call;
|
||||
use clippy_utils::res::{MaybeDef, MaybeQPath, MaybeResPath};
|
||||
use clippy_utils::sugg::Sugg;
|
||||
use clippy_utils::{
|
||||
SpanlessEq, get_enclosing_block, is_integer_literal, is_path_diagnostic_item, path_to_local, path_to_local_id,
|
||||
span_contains_comment, sym,
|
||||
SpanlessEq, get_enclosing_block, is_integer_literal, path_to_local, path_to_local_id, span_contains_comment, sym,
|
||||
};
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_hir::intravisit::{Visitor, walk_block, walk_expr, walk_stmt};
|
||||
|
|
@ -149,10 +149,10 @@ impl SlowVectorInit {
|
|||
}
|
||||
|
||||
if let ExprKind::Call(func, [len_expr]) = expr.kind
|
||||
&& is_path_diagnostic_item(cx, func, sym::vec_with_capacity)
|
||||
&& func.ty_rel_def(cx).is_diag_item(cx, sym::vec_with_capacity)
|
||||
{
|
||||
Some(InitializedSize::Initialized(len_expr))
|
||||
} else if matches!(expr.kind, ExprKind::Call(func, []) if is_path_diagnostic_item(cx, func, sym::vec_new)) {
|
||||
} else if matches!(expr.kind, ExprKind::Call(func, []) if func.ty_rel_def(cx).is_diag_item(cx, sym::vec_new)) {
|
||||
Some(InitializedSize::Uninitialized)
|
||||
} else {
|
||||
None
|
||||
|
|
@ -301,7 +301,7 @@ impl<'tcx> VectorInitializationVisitor<'_, 'tcx> {
|
|||
/// Returns `true` if given expression is `repeat(0)`
|
||||
fn is_repeat_zero(&self, expr: &Expr<'_>) -> bool {
|
||||
if let ExprKind::Call(fn_expr, [repeat_arg]) = expr.kind
|
||||
&& is_path_diagnostic_item(self.cx, fn_expr, sym::iter_repeat)
|
||||
&& fn_expr.basic_res().is_diag_item(self.cx, sym::iter_repeat)
|
||||
&& is_integer_literal(repeat_arg, 0)
|
||||
{
|
||||
true
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
use clippy_config::Conf;
|
||||
use clippy_utils::diagnostics::{span_lint, span_lint_and_sugg};
|
||||
use clippy_utils::msrvs::{self, Msrv};
|
||||
use clippy_utils::res::{MaybeDef, MaybeTypeckRes};
|
||||
use clippy_utils::sugg::Sugg;
|
||||
use clippy_utils::{is_path_diagnostic_item, ty};
|
||||
use clippy_utils::ty;
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_hir::{BinOpKind, Expr, ExprKind};
|
||||
use rustc_lint::{LateContext, LateLintPass};
|
||||
|
|
@ -146,7 +147,7 @@ impl LateLintPass<'_> for UncheckedTimeSubtraction {
|
|||
|
||||
fn is_instant_now_call(cx: &LateContext<'_>, expr_block: &'_ Expr<'_>) -> bool {
|
||||
if let ExprKind::Call(fn_expr, []) = expr_block.kind
|
||||
&& is_path_diagnostic_item(cx, fn_expr, sym::instant_now)
|
||||
&& cx.ty_based_def(fn_expr).is_diag_item(cx, sym::instant_now)
|
||||
{
|
||||
true
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
use clippy_config::Conf;
|
||||
use clippy_utils::diagnostics::span_lint_and_sugg;
|
||||
use clippy_utils::msrvs::{self, Msrv};
|
||||
use clippy_utils::res::{MaybeDef, MaybeQPath};
|
||||
use clippy_utils::source::snippet_with_applicability;
|
||||
use clippy_utils::{is_in_const_context, is_path_diagnostic_item, sym};
|
||||
use clippy_utils::{is_in_const_context, sym};
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_hir as hir;
|
||||
use rustc_lint::{LateContext, LateLintPass};
|
||||
|
|
@ -62,7 +63,7 @@ impl<'tcx> LateLintPass<'tcx> for ToDigitIsSome {
|
|||
}
|
||||
},
|
||||
hir::ExprKind::Call(to_digits_call, [char_arg, radix_arg]) => {
|
||||
if is_path_diagnostic_item(cx, to_digits_call, sym::char_to_digit) {
|
||||
if to_digits_call.ty_rel_def(cx).is_diag_item(cx, sym::char_to_digit) {
|
||||
Some((false, char_arg, radix_arg))
|
||||
} else {
|
||||
None
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
use clippy_utils::consts::{ConstEvalCtxt, Constant};
|
||||
use clippy_utils::diagnostics::span_lint_and_then;
|
||||
use clippy_utils::{is_integer_literal, is_path_diagnostic_item};
|
||||
use clippy_utils::is_integer_literal;
|
||||
use clippy_utils::res::{MaybeDef, MaybeResPath};
|
||||
use rustc_hir::{Expr, ExprKind};
|
||||
use rustc_lint::LateContext;
|
||||
use rustc_middle::ty::Ty;
|
||||
|
|
@ -40,7 +41,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>, arg: &'t
|
|||
},
|
||||
// Catching:
|
||||
// `std::mem::transmute(std::ptr::null::<i32>())`
|
||||
ExprKind::Call(func1, []) if is_path_diagnostic_item(cx, func1, sym::ptr_null) => {
|
||||
ExprKind::Call(func1, []) if func1.basic_res().is_diag_item(cx, sym::ptr_null) => {
|
||||
lint_expr(cx, expr);
|
||||
true
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
use clippy_utils::consts::{ConstEvalCtxt, Constant};
|
||||
use clippy_utils::diagnostics::span_lint;
|
||||
use clippy_utils::{is_integer_literal, is_path_diagnostic_item};
|
||||
use clippy_utils::is_integer_literal;
|
||||
use clippy_utils::res::{MaybeDef, MaybeResPath};
|
||||
use rustc_hir::{Expr, ExprKind};
|
||||
use rustc_lint::LateContext;
|
||||
use rustc_middle::ty::Ty;
|
||||
|
|
@ -35,7 +36,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>, arg: &'t
|
|||
// Catching:
|
||||
// `std::mem::transmute(std::ptr::null::<i32>())`
|
||||
if let ExprKind::Call(func1, []) = arg.kind
|
||||
&& is_path_diagnostic_item(cx, func1, sym::ptr_null)
|
||||
&& func1.basic_res().is_diag_item(cx, sym::ptr_null)
|
||||
{
|
||||
span_lint(cx, TRANSMUTING_NULL, expr.span, LINT_MSG);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ fn replacement(cx: &LateContext<'_>, cty: &hir::Ty<'_>) -> Option<(Span, String)
|
|||
if cty.basic_res().is_lang_item(cx, hir::LangItem::String) {
|
||||
return Some((cty.span, "str".into()));
|
||||
}
|
||||
if clippy_utils::is_path_diagnostic_item(cx, cty, sym::Vec) {
|
||||
if cty.basic_res().is_diag_item(cx, sym::Vec) {
|
||||
return if let hir::TyKind::Path(hir::QPath::Resolved(_, path)) = cty.kind
|
||||
&& let [.., last_seg] = path.segments
|
||||
&& let Some(args) = last_seg.args
|
||||
|
|
@ -46,7 +46,7 @@ fn replacement(cx: &LateContext<'_>, cty: &hir::Ty<'_>) -> Option<(Span, String)
|
|||
None
|
||||
};
|
||||
}
|
||||
if clippy_utils::is_path_diagnostic_item(cx, cty, sym::cstring_type) {
|
||||
if cty.basic_res().is_diag_item(cx, sym::cstring_type) {
|
||||
return Some((
|
||||
cty.span,
|
||||
(if clippy_utils::is_no_std_crate(cx) {
|
||||
|
|
@ -59,7 +59,7 @@ fn replacement(cx: &LateContext<'_>, cty: &hir::Ty<'_>) -> Option<(Span, String)
|
|||
}
|
||||
// Neither OsString nor PathBuf are available outside std
|
||||
for (diag, repl) in [(sym::OsString, "std::ffi::OsStr"), (sym::PathBuf, "std::path::Path")] {
|
||||
if clippy_utils::is_path_diagnostic_item(cx, cty, diag) {
|
||||
if cty.basic_res().is_diag_item(cx, diag) {
|
||||
return Some((cty.span, repl.into()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -298,7 +298,7 @@ impl<'a, 'tcx> PrintVisitor<'a, 'tcx> {
|
|||
if let Some(lang) = self.cx.tcx.lang_items().from_def_id(id) {
|
||||
chain!(self, "{path}.res(cx).is_lang_item(cx, LangItem::{}", lang.name());
|
||||
} else if let Some(name) = self.cx.tcx.get_diagnostic_name(id) {
|
||||
chain!(self, "is_path_diagnostic_item(cx, {path}, sym::{name})");
|
||||
chain!(self, "{path}.res(cx).is_diag_item(cx, sym::{name})");
|
||||
} else {
|
||||
chain!(
|
||||
self,
|
||||
|
|
|
|||
|
|
@ -438,16 +438,6 @@ pub fn qpath_generic_tys<'tcx>(qpath: &QPath<'tcx>) -> impl Iterator<Item = &'tc
|
|||
})
|
||||
}
|
||||
|
||||
/// If `maybe_path` is a path node which resolves to an item, resolves it to a `DefId` and checks if
|
||||
/// it matches the given diagnostic item.
|
||||
pub fn is_path_diagnostic_item<'tcx>(
|
||||
cx: &LateContext<'_>,
|
||||
maybe_path: &impl MaybePath<'tcx>,
|
||||
diag_item: Symbol,
|
||||
) -> bool {
|
||||
path_def_id(cx, maybe_path).is_some_and(|id| cx.tcx.is_diagnostic_item(diag_item, id))
|
||||
}
|
||||
|
||||
/// If the expression is a path to a local, returns the canonical `HirId` of the local.
|
||||
pub fn path_to_local(expr: &Expr<'_>) -> Option<HirId> {
|
||||
if let ExprKind::Path(QPath::Resolved(None, path)) = expr.kind
|
||||
|
|
@ -784,13 +774,13 @@ fn is_default_equivalent_from(cx: &LateContext<'_>, from_func: &Expr<'_>, arg: &
|
|||
node: LitKind::Str(sym, _),
|
||||
..
|
||||
}) => return sym.is_empty() && ty.basic_res().is_lang_item(cx, LangItem::String),
|
||||
ExprKind::Array([]) => return is_path_diagnostic_item(cx, ty, sym::Vec),
|
||||
ExprKind::Array([]) => return ty.basic_res().is_diag_item(cx, sym::Vec),
|
||||
ExprKind::Repeat(_, len) => {
|
||||
if let ConstArgKind::Anon(anon_const) = len.kind
|
||||
&& let ExprKind::Lit(const_lit) = cx.tcx.hir_body(anon_const.body).value.kind
|
||||
&& let LitKind::Int(v, _) = const_lit.node
|
||||
{
|
||||
return v == 0 && is_path_diagnostic_item(cx, ty, sym::Vec);
|
||||
return v == 0 && ty.basic_res().is_diag_item(cx, sym::Vec);
|
||||
}
|
||||
},
|
||||
_ => (),
|
||||
|
|
|
|||
|
|
@ -23,13 +23,13 @@ if let ExprKind::Block(block, None) = expr.kind
|
|||
&& let StmtKind::Let(local) = block.stmts[0].kind
|
||||
&& let Some(init) = local.init
|
||||
&& let ExprKind::Call(func, args) = init.kind
|
||||
&& is_path_diagnostic_item(cx, func, sym::string_new)
|
||||
&& func.res(cx).is_diag_item(cx, sym::string_new)
|
||||
&& args.is_empty()
|
||||
&& let PatKind::Binding(BindingMode::NONE, _, name, None) = local.pat.kind
|
||||
&& name.as_str() == "expr"
|
||||
&& let Some(trailing_expr) = block.expr
|
||||
&& let ExprKind::Call(func1, args1) = trailing_expr.kind
|
||||
&& is_path_diagnostic_item(cx, func1, sym::mem_drop)
|
||||
&& func1.res(cx).is_diag_item(cx, sym::mem_drop)
|
||||
&& args1.len() == 1
|
||||
{
|
||||
// report your lint here
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
if let StmtKind::Let(local) = stmt.kind
|
||||
&& let Some(init) = local.init
|
||||
&& let ExprKind::Call(func, args) = init.kind
|
||||
&& is_path_diagnostic_item(cx, func, sym::cmp_min)
|
||||
&& func.res(cx).is_diag_item(cx, sym::cmp_min)
|
||||
&& args.len() == 2
|
||||
&& let ExprKind::Lit(ref lit) = args[0].kind
|
||||
&& let LitKind::Int(3, LitIntType::Unsuffixed) = lit.node
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
if let StmtKind::Let(local) = stmt.kind
|
||||
&& let Some(init) = local.init
|
||||
&& let ExprKind::Call(func, args) = init.kind
|
||||
&& is_path_diagnostic_item(cx, func, sym::transmute)
|
||||
&& func.res(cx).is_diag_item(cx, sym::transmute)
|
||||
&& args.len() == 1
|
||||
&& let PatKind::Wild = local.pat.kind
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue