]> git.lizzy.rs Git - rust.git/blob - tests/compile-fail/complex_types.rs
Fix type complexity lint
[rust.git] / tests / compile-fail / complex_types.rs
1 #![feature(plugin)]
2 #![plugin(clippy)]
3 #![deny(clippy)]
4 #![allow(unused)]
5 #![feature(associated_consts, 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)))); //~ERROR very complex type
10 static ST: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0)))); //~ERROR very complex type
11
12 struct S {
13     f: Vec<Vec<Box<(u32, u32, u32, u32)>>>, //~ERROR very complex type
14 }
15
16 struct TS(Vec<Vec<Box<(u32, u32, u32, u32)>>>); //~ERROR very complex type
17
18 enum E {
19     V1(Vec<Vec<Box<(u32, u32, u32, u32)>>>), //~ERROR very complex type
20     V2 { f: Vec<Vec<Box<(u32, u32, u32, u32)>>> }, //~ERROR very complex type
21 }
22
23 impl S {
24     const A: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0)))); //~ERROR very complex type
25     fn impl_method(&self, p: Vec<Vec<Box<(u32, u32, u32, u32)>>>) { } //~ERROR very complex type
26 }
27
28 trait T {
29     const A: Vec<Vec<Box<(u32, u32, u32, u32)>>>; //~ERROR very complex type
30     type B = Vec<Vec<Box<(u32, u32, u32, u32)>>>; //~ERROR very complex type
31     fn method(&self, p: Vec<Vec<Box<(u32, u32, u32, u32)>>>); //~ERROR very complex type
32     fn def_method(&self, p: Vec<Vec<Box<(u32, u32, u32, u32)>>>) { } //~ERROR very complex type
33 }
34
35 fn test1() -> Vec<Vec<Box<(u32, u32, u32, u32)>>> { vec![] } //~ERROR very complex type
36
37 fn test2(_x: Vec<Vec<Box<(u32, u32, u32, u32)>>>) { } //~ERROR very complex type
38
39 fn test3() {
40     let _y: Vec<Vec<Box<(u32, u32, u32, u32)>>> = vec![]; //~ERROR very complex type
41 }
42
43 fn main() {
44 }