summaryrefslogtreecommitdiffstats
path: root/src/test/ui/suggestions/unused-closure-argument.rs
blob: 677003ebf225ca65d86b57d9fd064d75d2b4e509 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#![deny(unused_variables)]

struct Point {
    x: i32,
    y: i32,
}

fn main() {
    let points = vec!(Point { x: 1, y: 2 }, Point { x: 3, y: 4 });

    let _: i32 = points.iter()
        .map(|Point { x, y }| y)
        //~^ ERROR unused variable
        .sum();

    let _: i32 = points.iter()
        .map(|x| 4)
        //~^ ERROR unused variable
        .sum();
}