]> git.lizzy.rs Git - rust.git/blob - tests/ui/complex_types.rs
Merge pull request #3264 from joelgallant/extern-type-complexity
[rust.git] / tests / ui / complex_types.rs
1 #![feature(tool_lints)]
2
3 #![warn(clippy::all)]
4 #![allow(unused, clippy::needless_pass_by_value)]
5 #![feature(associated_type_defaults)]
6
7 type Alias = Vec<Vec<Box<(u32, u32, u32, u32)>>>; // no warning here
8
9 const CST: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0))));
10 static ST: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0))));
11
12 struct S {
13     f: Vec<Vec<Box<(u32, u32, u32, u32)>>>,
14 }
15
16 struct TS(Vec<Vec<Box<(u32, u32, u32, u32)>>>);
17
18 enum E {
19     Tuple(Vec<Vec<Box<(u32, u32, u32, u32)>>>),
20     Struct { f: Vec<Vec<Box<(u32, u32, u32, u32)>>> },
21 }
22
23 impl S {
24     const A: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0))));
25     fn impl_method(&self, p: Vec<Vec<Box<(u32, u32, u32, u32)>>>) { }
26 }
27
28 trait T {
29     const A: Vec<Vec<Box<(u32, u32, u32, u32)>>>;
30     type B = Vec<Vec<Box<(u32, u32, u32, u32)>>>;
31     fn method(&self, p: Vec<Vec<Box<(u32, u32, u32, u32)>>>);
32     fn def_method(&self, p: Vec<Vec<Box<(u32, u32, u32, u32)>>>) { }
33 }
34
35 fn test1() -> Vec<Vec<Box<(u32, u32, u32, u32)>>> { vec![] }
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() {
61 }