File tree 2 files changed +36
-0
lines changed
2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change
1
+ //@no-rustfix: no suggestions
2
+
3
+ #![ warn( clippy:: useless_vec) ]
4
+
5
+ // Regression test for <https://github.com/rust-lang/rust-clippy/issues/13692>.
6
+ fn foo ( ) {
7
+ // There should be no suggestion in this case.
8
+ let _some_variable = vec ! [
9
+ //~^ useless_vec
10
+ 1 , 2 , // i'm here to stay
11
+ 3 , 4 , // but this one going away ;-;
12
+ ] ; // that is life anyways
13
+ }
14
+
15
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error: useless use of `vec!`
2
+ --> tests/ui/useless_vec.rs:8:26
3
+ |
4
+ LL | let _some_variable = vec![
5
+ | __________________________^
6
+ LL | |
7
+ LL | | 1, 2, // i'm here to stay
8
+ LL | | 3, 4, // but this one going away ;-;
9
+ LL | | ]; // that is life anyways
10
+ | |_____^
11
+ |
12
+ = note: `-D clippy::useless-vec` implied by `-D warnings`
13
+ = help: to override `-D warnings` add `#[allow(clippy::useless_vec)]`
14
+ help: you can use an array directly
15
+ |
16
+ LL ~ let _some_variable = [1, 2, // i'm here to stay
17
+ LL ~ 3, 4]; // that is life anyways
18
+ |
19
+
20
+ error: aborting due to 1 previous error
21
+
You can’t perform that action at this time.
0 commit comments