Skip to content

Commit 99d07ef

Browse files
committed
clear in_macro
1 parent 662267f commit 99d07ef

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

clippy_lints/src/needless_deref.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use clippy_utils::diagnostics::span_lint_and_help;
2-
use clippy_utils::in_macro;
32
use clippy_utils::source::snippet_opt;
43
use rustc_hir::{ExprKind, UnOp};
54
use rustc_lint::{LateContext, LateLintPass};
@@ -44,7 +43,7 @@ declare_lint_pass!(NeedlessDeref => [NEEDLESS_DEREF]);
4443
impl LateLintPass<'_> for NeedlessDeref {
4544
fn check_expr(&mut self, cx: &LateContext<'tcx>, e: &'tcx rustc_hir::Expr<'_>) {
4645
if_chain! {
47-
if !e.span.from_expansion() && !in_macro(e.span);
46+
if !e.span.from_expansion();
4847
if let ExprKind::AddrOf(_, Mutability::Not, addrof_target) = e.kind;
4948
if let ExprKind::Unary(UnOp::Deref, deref_target) = addrof_target.kind;
5049
if !matches!(deref_target.kind, ExprKind::Unary(UnOp::Deref, ..) );
@@ -55,7 +54,7 @@ impl LateLintPass<'_> for NeedlessDeref {
5554
let map = cx.tcx.hir();
5655
if let Some(parent_hir_id) = map.find_parent_node(e.hir_id){
5756
let span=map.span(parent_hir_id);
58-
if span.from_expansion() || in_macro(span) {
57+
if span.from_expansion() {
5958
return;
6059
}
6160
let parent_node = map.find(parent_hir_id);

0 commit comments

Comments
 (0)