diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-07-08 08:00:41 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-08 08:00:41 +0200 |
| commit | 1e033a9818b305b9b22e26e18c81729099aa9c19 (patch) | |
| tree | 76a18e1e077b8be6220a8c5a504cb16d3a68c20c /tests/ui/used_underscore_binding.rs | |
| parent | bee9da14cd8ce7b3c735645bd260eb34c6b53dcb (diff) | |
| parent | 3388787615ce3535f8c18d25c12643b3021a407c (diff) | |
| download | rust-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 'tests/ui/used_underscore_binding.rs')
| -rw-r--r-- | tests/ui/used_underscore_binding.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/ui/used_underscore_binding.rs b/tests/ui/used_underscore_binding.rs index 21d66d5df79..d20977d55d2 100644 --- a/tests/ui/used_underscore_binding.rs +++ b/tests/ui/used_underscore_binding.rs @@ -44,6 +44,12 @@ fn in_struct_field() { s._underscore_field += 1; } +/// Tests that we do not lint if the struct field is used in code created with derive. +#[derive(Clone, Debug)] +pub struct UnderscoreInStruct { + _foo: u32, +} + /// Tests that we do not lint if the underscore is not a prefix fn non_prefix_underscore(some_foo: u32) -> u32 { some_foo + 1 |
