File tree Expand file tree Collapse file tree 1 file changed +2
-3
lines changed Expand file tree Collapse file tree 1 file changed +2
-3
lines changed Original file line number Diff line number Diff line change 1
1
use clippy_utils:: diagnostics:: span_lint_and_help;
2
- use clippy_utils:: in_macro;
3
2
use clippy_utils:: source:: snippet_opt;
4
3
use rustc_hir:: { ExprKind , UnOp } ;
5
4
use rustc_lint:: { LateContext , LateLintPass } ;
@@ -44,7 +43,7 @@ declare_lint_pass!(NeedlessDeref => [NEEDLESS_DEREF]);
44
43
impl LateLintPass < ' _ > for NeedlessDeref {
45
44
fn check_expr ( & mut self , cx : & LateContext < ' tcx > , e : & ' tcx rustc_hir:: Expr < ' _ > ) {
46
45
if_chain ! {
47
- if !e. span. from_expansion( ) && !in_macro ( e . span ) ;
46
+ if !e. span. from_expansion( ) ;
48
47
if let ExprKind :: AddrOf ( _, Mutability :: Not , addrof_target) = e. kind;
49
48
if let ExprKind :: Unary ( UnOp :: Deref , deref_target) = addrof_target. kind;
50
49
if !matches!( deref_target. kind, ExprKind :: Unary ( UnOp :: Deref , ..) ) ;
@@ -55,7 +54,7 @@ impl LateLintPass<'_> for NeedlessDeref {
55
54
let map = cx. tcx. hir( ) ;
56
55
if let Some ( parent_hir_id) = map. find_parent_node( e. hir_id) {
57
56
let span=map. span( parent_hir_id) ;
58
- if span. from_expansion( ) || in_macro ( span ) {
57
+ if span. from_expansion( ) {
59
58
return ;
60
59
}
61
60
let parent_node = map. find( parent_hir_id) ;
You can’t perform that action at this time.
0 commit comments