diff options
| author | Jason Newcomb <jsnewcomb@pm.me> | 2022-01-12 00:25:42 -0500 |
|---|---|---|
| committer | Jason Newcomb <jsnewcomb@pm.me> | 2022-01-12 00:25:42 -0500 |
| commit | d32277d78edfec2c8293fb887aff1783d4595653 (patch) | |
| tree | 0aa05711efe580ad4a4abcb207ec26fe9e55ca38 /clippy_lints/src/reference.rs | |
| parent | 88f5be2041acca3da00648ffc10846dab25cfb5f (diff) | |
| download | rust-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.rs | 1 |
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; |
