]> git.proxmox.com Git - rustc.git/blob - tests/ui/lint/unused_braces_borrow.fixed
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / lint / unused_braces_borrow.fixed
1 // check-pass
2 // run-rustfix
3
4 #![warn(unused_braces)]
5
6 // changing `&{ expr }` to `&expr` changes the semantic of the program
7 // so we should not warn this case
8
9 #[repr(packed)]
10 pub struct A {
11 pub a: u8,
12 pub b: u32,
13 }
14
15 fn consume<T>(_: T) {}
16
17 fn main() {
18 let a = A {
19 a: 42,
20 b: 1729,
21 };
22
23 consume(&{ a.b });
24 consume(a.b);
25 //~^ WARN unnecessary braces
26 }