@@ -61,12 +61,13 @@ enum VecState {
61
61
pub struct UselessVec {
62
62
too_large_for_stack : u64 ,
63
63
msrv : Msrv ,
64
- /// Maps from a `vec![]` source callsite invocation span to the "state" (i.e., whether we can emit a warning there or not).
64
+ /// Maps from a `vec![]` source callsite invocation span to the "state" (i.e., whether we can
65
+ /// emit a warning there or not).
65
66
///
66
- /// The purpose of this is to buffer lints up until `check_expr_post` so that we can cancel a lint while visiting,
67
- /// because a `vec![]` invocation span can appear multiple times when it is passed as a macro argument,
68
- /// once in a context that doesn't require a `Vec<_>` and another time that does. Consider:
69
- /// ```
67
+ /// The purpose of this is to buffer lints up until `check_expr_post` so that we can cancel a
68
+ /// lint while visiting, because a `vec![]` invocation span can appear multiple times when
69
+ /// it is passed as a macro argument, once in a context that doesn't require a `Vec<_>` and
70
+ /// another time that does. Consider: ```
70
71
/// macro_rules! m {
71
72
/// ($v:expr) => {
72
73
/// let a = $v;
@@ -75,8 +76,9 @@ pub struct UselessVec {
75
76
/// }
76
77
/// m!(vec![1, 2]);
77
78
/// ```
78
- /// The macro invocation expands to two `vec![1, 2]` invocations. If we eagerly suggest changing it to an array,
79
- /// we get a false positive warning on the `$v.push(3)` which really requires `$v` to be a vector.
79
+ /// The macro invocation expands to two `vec![1, 2]` invocations. If we eagerly suggest changing
80
+ /// it to an array, we get a false positive warning on the `$v.push(3)` which really
81
+ /// requires `$v` to be a vector.
80
82
span_to_state : BTreeMap < Span , VecState > ,
81
83
allow_in_test : bool ,
82
84
}
@@ -93,7 +95,8 @@ impl UselessVec {
93
95
}
94
96
95
97
enum VecToArray {
96
- /// Expression does not need to be a `Vec<_>` and its type can be changed to an array (or slice).
98
+ /// Expression does not need to be a `Vec<_>` and its type can be changed to an array (or
99
+ /// slice).
97
100
Possible ,
98
101
/// Expression must be a `Vec<_>`. Type cannot change.
99
102
Impossible ,
0 commit comments