@@ -61,12 +61,13 @@ enum VecState {
6161pub struct UselessVec {
6262 too_large_for_stack : u64 ,
6363 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).
6566 ///
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: ```
7071 /// macro_rules! m {
7172 /// ($v:expr) => {
7273 /// let a = $v;
@@ -75,8 +76,9 @@ pub struct UselessVec {
7576 /// }
7677 /// m!(vec![1, 2]);
7778 /// ```
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.
8082 span_to_state : BTreeMap < Span , VecState > ,
8183 allow_in_test : bool ,
8284}
@@ -93,7 +95,8 @@ impl UselessVec {
9395}
9496
9597enum 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).
97100 Possible ,
98101 /// Expression must be a `Vec<_>`. Type cannot change.
99102 Impossible ,
0 commit comments