summaryrefslogtreecommitdiffstats
path: root/tests/ui/nll/issue-47022.rs
blob: 521643c664de93d82a6e64e2d938a7635ebd6c67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// check-pass

struct LoadedObject {
    bodies: Vec<Body>,
    color: Color,
}

struct Body;

#[derive(Clone)]
struct Color;

struct Graphic {
    color: Color,
}

fn convert(objects: Vec<LoadedObject>) -> (Vec<Body>, Vec<Graphic>) {
    objects
        .into_iter()
        .flat_map(|LoadedObject { bodies, color, .. }| {
            bodies.into_iter().map(move |body| {
                (
                    body,
                    Graphic {
                        color: color.clone(),
                    },
                )
            })
        })
        .unzip()
}

fn main() {}