]> git.lizzy.rs Git - rust.git/blob - tests/ui/complex_types.rs
Auto merge of #3603 - xfix:random-state-lint, r=phansch
[rust.git] / tests / ui / complex_types.rs
1 // Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution.
3 //
4 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
7 // option. This file may not be copied, modified, or distributed
8 // except according to those terms.
9
10 #![warn(clippy::all)]
11 #![allow(unused, clippy::needless_pass_by_value)]
12 #![feature(associated_type_defaults)]
13
14 type Alias = Vec<Vec<Box<(u32, u32, u32, u32)>>>; // no warning here
15
16 const CST: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0))));
17 static ST: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0))));
18
19 struct S {
20     f: Vec<Vec<Box<(u32, u32, u32, u32)>>>,
21 }
22
23 struct TS(Vec<Vec<Box<(u32, u32, u32, u32)>>>);
24
25 enum E {
26     Tuple(Vec<Vec<Box<(u32, u32, u32, u32)>>>),
27     Struct { f: Vec<Vec<Box<(u32, u32, u32, u32)>>> },
28 }
29
30 impl S {
31     const A: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0))));
32     fn impl_method(&self, p: Vec<Vec<Box<(u32, u32, u32, u32)>>>) {}
33 }
34
35 trait T {
36     const A: Vec<Vec<Box<(u32, u32, u32, u32)>>>;
37     type B = Vec<Vec<Box<(u32, u32, u32, u32)>>>;
38     fn method(&self, p: Vec<Vec<Box<(u32, u32, u32, u32)>>>);
39     fn def_method(&self, p: Vec<Vec<Box<(u32, u32, u32, u32)>>>) {}
40 }
41
42 fn test1() -> Vec<Vec<Box<(u32, u32, u32, u32)>>> {
43     vec![]
44 }
45
46 fn test2(_x: Vec<Vec<Box<(u32, u32, u32, u32)>>>) {}
47
48 fn test3() {
49     let _y: Vec<Vec<Box<(u32, u32, u32, u32)>>> = vec![];
50 }
51
52 #[repr(C)]
53 struct D {
54     // should not warn, since we don't have control over the signature (#3222)
55     test4: extern "C" fn(
56         itself: &D,
57         a: usize,
58         b: usize,
59         c: usize,
60         d: usize,
61         e: usize,
62         f: usize,
63         g: usize,
64         h: usize,
65         i: usize,
66     ),
67 }
68
69 fn main() {}