]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrow_box.rs
Remove all copyright license headers
[rust.git] / tests / ui / borrow_box.rs
1 #![deny(clippy::borrowed_box)]
2 #![allow(clippy::blacklisted_name)]
3 #![allow(unused_variables)]
4 #![allow(dead_code)]
5
6 pub fn test1(foo: &mut Box<bool>) {
7     println!("{:?}", foo)
8 }
9
10 pub fn test2() {
11     let foo: &Box<bool>;
12 }
13
14 struct Test3<'a> {
15     foo: &'a Box<bool>,
16 }
17
18 trait Test4 {
19     fn test4(a: &Box<bool>);
20 }
21
22 impl<'a> Test4 for Test3<'a> {
23     fn test4(a: &Box<bool>) {
24         unimplemented!();
25     }
26 }
27
28 use std::any::Any;
29
30 pub fn test5(foo: &mut Box<Any>) {
31     println!("{:?}", foo)
32 }
33
34 pub fn test6() {
35     let foo: &Box<Any>;
36 }
37
38 struct Test7<'a> {
39     foo: &'a Box<Any>,
40 }
41
42 trait Test8 {
43     fn test8(a: &Box<Any>);
44 }
45
46 impl<'a> Test8 for Test7<'a> {
47     fn test8(a: &Box<Any>) {
48         unimplemented!();
49     }
50 }
51
52 pub fn test9(foo: &mut Box<Any + Send + Sync>) {
53     let _ = foo;
54 }
55
56 pub fn test10() {
57     let foo: &Box<Any + Send + 'static>;
58 }
59
60 struct Test11<'a> {
61     foo: &'a Box<Any + Send>,
62 }
63
64 trait Test12 {
65     fn test4(a: &Box<Any + 'static>);
66 }
67
68 impl<'a> Test12 for Test11<'a> {
69     fn test4(a: &Box<Any + 'static>) {
70         unimplemented!();
71     }
72 }
73
74 fn main() {
75     test1(&mut Box::new(false));
76     test2();
77     test5(&mut (Box::new(false) as Box<Any>));
78     test6();
79     test9(&mut (Box::new(false) as Box<Any + Send + Sync>));
80     test10();
81 }