diff options
| author | Andrea Nall <anall@andreanall.com> | 2022-07-07 19:30:37 +0000 |
|---|---|---|
| committer | Andrea Nall <anall@andreanall.com> | 2022-07-07 19:30:37 +0000 |
| commit | 3388787615ce3535f8c18d25c12643b3021a407c (patch) | |
| tree | c635d314304bc4c2ea81b71b893094f166efdc5b /tests | |
| parent | 5474f56bcf08584211ce7207568204ae7ac481db (diff) | |
| download | rust-3388787615ce3535f8c18d25c12643b3021a407c.tar.gz rust-3388787615ce3535f8c18d25c12643b3021a407c.zip | |
Add test for and fix rust-lang/rust-clippy#9131
This lint seems to have been broken by #98446
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/used_underscore_binding.rs | 6 | ||||
| -rw-r--r-- | tests/ui/used_underscore_binding.stderr | 2 |
2 files changed, 7 insertions, 1 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 diff --git a/tests/ui/used_underscore_binding.stderr b/tests/ui/used_underscore_binding.stderr index 790b849210c..61a9161d212 100644 --- a/tests/ui/used_underscore_binding.stderr +++ b/tests/ui/used_underscore_binding.stderr @@ -31,7 +31,7 @@ LL | s._underscore_field += 1; | ^^^^^^^^^^^^^^^^^^^ error: used binding `_i` which is prefixed with an underscore. A leading underscore signals that a binding will not be used - --> $DIR/used_underscore_binding.rs:99:16 + --> $DIR/used_underscore_binding.rs:105:16 | LL | uses_i(_i); | ^^ |
