]> git.proxmox.com Git - rustc.git/blame - src/tools/clippy/tests/ui/complex_types.rs
Update upstream source from tag 'upstream/1.52.1+dfsg1'
[rustc.git] / src / tools / clippy / tests / ui / complex_types.rs
CommitLineData
f20569fa
XL
1#![warn(clippy::all)]
2#![allow(unused, clippy::needless_pass_by_value, clippy::vec_box)]
3#![feature(associated_type_defaults)]
4
5type Alias = Vec<Vec<Box<(u32, u32, u32, u32)>>>; // no warning here
6
7const CST: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0))));
8static ST: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0))));
9
10struct S {
11 f: Vec<Vec<Box<(u32, u32, u32, u32)>>>,
12}
13
14struct Ts(Vec<Vec<Box<(u32, u32, u32, u32)>>>);
15
16enum E {
17 Tuple(Vec<Vec<Box<(u32, u32, u32, u32)>>>),
18 Struct { f: Vec<Vec<Box<(u32, u32, u32, u32)>>> },
19}
20
21impl 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
26trait 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
33fn test1() -> Vec<Vec<Box<(u32, u32, u32, u32)>>> {
34 vec![]
35}
36
37fn test2(_x: Vec<Vec<Box<(u32, u32, u32, u32)>>>) {}
38
39fn test3() {
40 let _y: Vec<Vec<Box<(u32, u32, u32, u32)>>> = vec![];
41}
42
43#[repr(C)]
44struct 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
60fn main() {}