]> git.lizzy.rs Git - rust.git/blob - tests/ui/complex_types.rs
iterate List by value
[rust.git] / tests / ui / complex_types.rs
1 #![warn(clippy::all)]
2 #![allow(unused, clippy::needless_pass_by_value, clippy::vec_box)]
3 #![feature(associated_type_defaults)]
4
5 type Alias = Vec<Vec<Box<(u32, u32, u32, u32)>>>; // no warning here
6
7 const CST: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0))));
8 static ST: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0))));
9
10 struct S {
11     f: Vec<Vec<Box<(u32, u32, u32, u32)>>>,
12 }
13
14 struct TS(Vec<Vec<Box<(u32, u32, u32, u32)>>>);
15
16 enum E {
17     Tuple(Vec<Vec<Box<(u32, u32, u32, u32)>>>),
18     Struct { f: Vec<Vec<Box<(u32, u32, u32, u32)>>> },
19 }
20
21 impl S {
22     const A: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0))));
23     fn impl_method(&self, p: Vec<Vec<Box<(u32, u32, u32, u32)>>>) {}
24 }
25
26 trait T {
27     const A: Vec<Vec<Box<(u32, u32, u32, u32)>>>;
28     type B = Vec<Vec<Box<(u32, u32, u32, u32)>>>;
29     fn method(&self, p: Vec<Vec<Box<(u32, u32, u32, u32)>>>);
30     fn def_method(&self, p: Vec<Vec<Box<(u32, u32, u32, u32)>>>) {}
31 }
32
33 fn test1() -> Vec<Vec<Box<(u32, u32, u32, u32)>>> {
34     vec![]
35 }
36
37 fn test2(_x: Vec<Vec<Box<(u32, u32, u32, u32)>>>) {}
38
39 fn test3() {
40     let _y: Vec<Vec<Box<(u32, u32, u32, u32)>>> = vec![];
41 }
42
43 #[repr(C)]
44 struct D {
45     // should not warn, since we don't have control over the signature (#3222)
46     test4: extern "C" fn(
47         itself: &D,
48         a: usize,
49         b: usize,
50         c: usize,
51         d: usize,
52         e: usize,
53         f: usize,
54         g: usize,
55         h: usize,
56         i: usize,
57     ),
58 }
59
60 fn main() {}