]> git.proxmox.com Git - rustc.git/blob - tests/ui/lint/unused/issue-54180-unused-ref-field.fixed
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / lint / unused / issue-54180-unused-ref-field.fixed
1 // run-rustfix
2
3 #![deny(unused)]
4
5 pub struct S {
6 pub f1: i32,
7 }
8
9 pub struct Point {
10 pub x: i32,
11 pub y: i32,
12 }
13
14 pub enum E {
15 Variant { field: String }
16 }
17
18 pub fn foo(arg: &E) {
19 match arg {
20 E::Variant { field: _ } => (), //~ ERROR unused variable
21 }
22 }
23
24 fn main() {
25 let s = S { f1: 123 };
26 let S { f1: _ } = s; //~ ERROR unused variable
27
28 let points = vec![Point { x: 1, y: 2 }];
29 let _: i32 = points.iter().map(|Point { x: _, y }| y).sum(); //~ ERROR unused variable
30
31 match (Point { x: 1, y: 2 }) {
32 Point { y, x: _ } => y, //~ ERROR unused variable
33 };
34 }