]> git.lizzy.rs Git - rust.git/blob - tests/ui/box_vec.rs
Auto merge of #88214 - notriddle:notriddle/for-loop-span-drop-temps-mut, r=nagisa
[rust.git] / tests / ui / box_vec.rs
1 #![warn(clippy::all)]
2 #![allow(
3     clippy::boxed_local,
4     clippy::needless_pass_by_value,
5     clippy::blacklisted_name,
6     unused
7 )]
8
9 macro_rules! boxit {
10     ($init:expr, $x:ty) => {
11         let _: Box<$x> = Box::new($init);
12     };
13 }
14
15 fn test_macro() {
16     boxit!(Vec::new(), Vec<u8>);
17 }
18 fn test(foo: Box<Vec<bool>>) {}
19
20 fn test2(foo: Box<dyn Fn(Vec<u32>)>) {
21     // pass if #31 is fixed
22     foo(vec![1, 2, 3])
23 }
24
25 fn test_local_not_linted() {
26     let _: Box<Vec<bool>>;
27 }
28
29 // All of these test should be allowed because they are part of the
30 // public api and `avoid_breaking_exported_api` is `false` by default.
31 pub fn pub_test(foo: Box<Vec<bool>>) {}
32 pub fn pub_test_ret() -> Box<Vec<bool>> {
33     Box::new(Vec::new())
34 }
35
36 fn main() {}