fork/rust
git clone https://git.julia.blue/fork/rust
49cae55760d
1.44.0
1// run-rustfix 2 3#![allow(nonstandard_style, unused_variables, unused_mut)] 4#![deny(non_shorthand_field_patterns)] 5 6struct Foo { 7 x: isize, 8 y: isize, 9} 10 11fn main() { 12 { 13 let Foo { 14 x, //~ ERROR the `x:` in this pattern is redundant 15 ref y, //~ ERROR the `y:` in this pattern is redundant 16 } = Foo { x: 0, y: 0 }; 17 18 let Foo { 19 x, 20 ref y, 21 } = Foo { x: 0, y: 0 }; 22 } 23 24 { 25 const x: isize = 1; 26 27 match (Foo { x: 1, y: 1 }) { 28 Foo { x: x, ..} => {}, 29 _ => {}, 30 } 31 } 32 33 { 34 struct Bar { 35 x: x, 36 } 37 38 struct x; 39 40 match (Bar { x: x }) { 41 Bar { x: x } => {}, 42 } 43 } 44 45 { 46 struct Bar { 47 x: Foo, 48 } 49 50 enum Foo { x } 51 52 match (Bar { x: Foo::x }) { 53 Bar { x: Foo::x } => {}, 54 } 55 } 56 57 { 58 struct Baz { 59 x: isize, 60 y: isize, 61 z: isize, 62 } 63 64 let Baz { 65 mut x, //~ ERROR the `x:` in this pattern is redundant 66 ref y, //~ ERROR the `y:` in this pattern is redundant 67 ref mut z, //~ ERROR the `z:` in this pattern is redundant 68 } = Baz { x: 0, y: 0, z: 0 }; 69 } 70}