]> git.lizzy.rs Git - rust.git/blob - tests/ui/box_vec.rs
Merge pull request #2984 from flip1995/single_char_pattern
[rust.git] / tests / ui / box_vec.rs
1
2
3
4 #![warn(clippy)]
5 #![allow(boxed_local, needless_pass_by_value)]
6 #![allow(blacklisted_name)]
7
8 macro_rules! boxit {
9     ($init:expr, $x:ty) => {
10         let _: Box<$x> = Box::new($init);
11     }
12 }
13
14 fn test_macro() {
15     boxit!(Vec::new(), Vec<u8>);
16 }
17 pub fn test(foo: Box<Vec<bool>>) {
18     println!("{:?}", foo.get(0))
19 }
20
21 pub fn test2(foo: Box<Fn(Vec<u32>)>) { // pass if #31 is fixed
22     foo(vec![1, 2, 3])
23 }
24
25 pub fn test_local_not_linted() {
26     let _: Box<Vec<bool>>;
27 }
28
29 fn main(){
30     test(Box::new(Vec::new()));
31     test2(Box::new(|v| println!("{:?}", v)));
32     test_macro();
33     test_local_not_linted();
34 }