mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 09:14:20 +00:00
21 lines
535 B
Rust
21 lines
535 B
Rust
// Regression test for #88403, where prefixing with an underscore was
|
|
// erroneously suggested for a nested shorthand struct field binding.
|
|
|
|
// run-rustfix
|
|
#![allow(unused)]
|
|
#![forbid(unused_variables)]
|
|
|
|
struct Inner { i: i32 }
|
|
struct Outer { o: Inner }
|
|
|
|
fn foo(Outer { o: Inner { i } }: Outer) {}
|
|
//~^ ERROR: unused variable: `i`
|
|
//~| HELP: try ignoring the field
|
|
|
|
fn main() {
|
|
let s = Outer { o: Inner { i: 42 } };
|
|
let Outer { o: Inner { i } } = s;
|
|
//~^ ERROR: unused variable: `i`
|
|
//~| HELP: try ignoring the field
|
|
}
|