Skip to content

Commit 40a6c51

Browse files
committed
Update tests for type_complexity lint
1 parent 063f8aa commit 40a6c51

File tree

3 files changed

+24
-27
lines changed

3 files changed

+24
-27
lines changed

tests/ui/type_complexity.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ trait T {
3030
fn def_method(&self, p: Vec<Vec<Box<(u32, u32, u32, u32)>>>) {}
3131
}
3232

33+
impl T for () {
34+
const A: Vec<Vec<Box<(u32, u32, u32, u32)>>> = vec![];
35+
36+
// Should not warn since there is likely no way to simplify this (#1013)
37+
type B = Vec<Vec<Box<(u32, u32, u32, u32)>>>;
38+
fn method(&self, p: Vec<Vec<Box<(u32, u32, u32, u32)>>>) {}
39+
}
40+
3341
fn test1() -> Vec<Vec<Box<(u32, u32, u32, u32)>>> {
3442
vec![]
3543
}

tests/ui/type_complexity.stderr

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,22 +73,34 @@ LL | fn def_method(&self, p: Vec<Vec<Box<(u32, u32, u32, u32)>>>) {}
7373
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7474

7575
error: very complex type used. Consider factoring parts into `type` definitions
76-
--> $DIR/type_complexity.rs:33:15
76+
--> $DIR/type_complexity.rs:34:14
77+
|
78+
LL | const A: Vec<Vec<Box<(u32, u32, u32, u32)>>> = vec![];
79+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
80+
81+
error: very complex type used. Consider factoring parts into `type` definitions
82+
--> $DIR/type_complexity.rs:38:25
83+
|
84+
LL | fn method(&self, p: Vec<Vec<Box<(u32, u32, u32, u32)>>>) {}
85+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
86+
87+
error: very complex type used. Consider factoring parts into `type` definitions
88+
--> $DIR/type_complexity.rs:41:15
7789
|
7890
LL | fn test1() -> Vec<Vec<Box<(u32, u32, u32, u32)>>> {
7991
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
8092

8193
error: very complex type used. Consider factoring parts into `type` definitions
82-
--> $DIR/type_complexity.rs:37:14
94+
--> $DIR/type_complexity.rs:45:14
8395
|
8496
LL | fn test2(_x: Vec<Vec<Box<(u32, u32, u32, u32)>>>) {}
8597
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
8698

8799
error: very complex type used. Consider factoring parts into `type` definitions
88-
--> $DIR/type_complexity.rs:40:13
100+
--> $DIR/type_complexity.rs:48:13
89101
|
90102
LL | let _y: Vec<Vec<Box<(u32, u32, u32, u32)>>> = vec![];
91103
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
92104

93-
error: aborting due to 15 previous errors
105+
error: aborting due to 17 previous errors
94106

tests/ui/type_complexity_issue_1013.rs

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)