about summary refs log tree commit diff
path: root/clippy_lints/src/misc.rs
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-07-08 08:00:41 +0200
committerGitHub <noreply@github.com>2022-07-08 08:00:41 +0200
commit1e033a9818b305b9b22e26e18c81729099aa9c19 (patch)
tree76a18e1e077b8be6220a8c5a504cb16d3a68c20c /clippy_lints/src/misc.rs
parentbee9da14cd8ce7b3c735645bd260eb34c6b53dcb (diff)
parent3388787615ce3535f8c18d25c12643b3021a407c (diff)
downloadrust-1e033a9818b305b9b22e26e18c81729099aa9c19.tar.gz
rust-1e033a9818b305b9b22e26e18c81729099aa9c19.zip
Rollup merge of #99026 - anall:buffix/clippy-9131, r=xFrednet
Add test for and fix rust-lang/rust-clippy#9131

This lint seems to have been broken by #98446 -- but of course, there was no clippy test for this case at the time.

`expr.span.ctxt().outer_expn_data()` now has `MacroKind::Derive` instead of `MacroKind::Attr` for something like:

```
#[derive(Clone, Debug)]
pub struct UnderscoreInStruct {
    _foo: u32,
}
```

---

changelog: none

closes: https://github.com/rust-lang/rust-clippy/issues/9131
Diffstat (limited to 'clippy_lints/src/misc.rs')
-rw-r--r--clippy_lints/src/misc.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/clippy_lints/src/misc.rs b/clippy_lints/src/misc.rs
index df2430ced6b..be7df08d89f 100644
--- a/clippy_lints/src/misc.rs
+++ b/clippy_lints/src/misc.rs
@@ -301,7 +301,7 @@ fn in_attributes_expansion(expr: &Expr<'_>) -> bool {
     use rustc_span::hygiene::MacroKind;
     if expr.span.from_expansion() {
         let data = expr.span.ctxt().outer_expn_data();
-        matches!(data.kind, ExpnKind::Macro(MacroKind::Attr, _))
+        matches!(data.kind, ExpnKind::Macro(MacroKind::Attr|MacroKind::Derive, _))
     } else {
         false
     }