fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #67350 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum73528e339aa

1.40.0
611 B34 linesraw
1// run-rustfix
2
3#![deny(unused)]
4
5pub struct S {
6    pub f1: i32,
7}
8
9pub struct Point {
10    pub x: i32,
11    pub y: i32,
12}
13
14pub enum E {
15    Variant { field: String }
16}
17
18pub fn foo(arg: &E) {
19    match arg {
20        E::Variant { field: _ } => (), //~ ERROR unused variable
21    }
22}
23
24fn 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}