about summary refs log tree commit diff
path: root/clippy_lints/src/reference.rs
diff options
context:
space:
mode:
authorJason Newcomb <jsnewcomb@pm.me>2022-01-12 00:25:42 -0500
committerJason Newcomb <jsnewcomb@pm.me>2022-01-12 00:25:42 -0500
commitd32277d78edfec2c8293fb887aff1783d4595653 (patch)
tree0aa05711efe580ad4a4abcb207ec26fe9e55ca38 /clippy_lints/src/reference.rs
parent88f5be2041acca3da00648ffc10846dab25cfb5f (diff)
downloadrust-d32277d78edfec2c8293fb887aff1783d4595653.tar.gz
rust-d32277d78edfec2c8293fb887aff1783d4595653.zip
Don't lint `deref_addrof` when the two operations occur in different expansions
Diffstat (limited to 'clippy_lints/src/reference.rs')
-rw-r--r--clippy_lints/src/reference.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/clippy_lints/src/reference.rs b/clippy_lints/src/reference.rs
index 22ae7a291d0..b2448372370 100644
--- a/clippy_lints/src/reference.rs
+++ b/clippy_lints/src/reference.rs
@@ -50,6 +50,7 @@ impl EarlyLintPass for DerefAddrOf {
         if_chain! {
             if let ExprKind::Unary(UnOp::Deref, ref deref_target) = e.kind;
             if let ExprKind::AddrOf(_, ref mutability, ref addrof_target) = without_parens(deref_target).kind;
+            if deref_target.span.ctxt() == e.span.ctxt();
             if !addrof_target.span.from_expansion();
             then {
                 let mut applicability = Applicability::MachineApplicable;