]> git.proxmox.com Git - rustc.git/blame - src/tools/clippy/tests/ui/box_vec.rs
Update upstream source from tag 'upstream/1.52.1+dfsg1'
[rustc.git] / src / tools / clippy / tests / ui / box_vec.rs
CommitLineData
f20569fa
XL
1#![warn(clippy::all)]
2#![allow(clippy::boxed_local, clippy::needless_pass_by_value)]
3#![allow(clippy::blacklisted_name)]
4
5macro_rules! boxit {
6 ($init:expr, $x:ty) => {
7 let _: Box<$x> = Box::new($init);
8 };
9}
10
11fn test_macro() {
12 boxit!(Vec::new(), Vec<u8>);
13}
14pub fn test(foo: Box<Vec<bool>>) {
15 println!("{:?}", foo.get(0))
16}
17
18pub fn test2(foo: Box<dyn Fn(Vec<u32>)>) {
19 // pass if #31 is fixed
20 foo(vec![1, 2, 3])
21}
22
23pub fn test_local_not_linted() {
24 let _: Box<Vec<bool>>;
25}
26
27fn main() {
28 test(Box::new(Vec::new()));
29 test2(Box::new(|v| println!("{:?}", v)));
30 test_macro();
31 test_local_not_linted();
32}