@@ -74,9 +74,7 @@ impl<'tcx> LateLintPass<'tcx> for ReserveAfterInitialization {
74
74
&& let PatKind :: Binding ( BindingAnnotation :: MUT , id, _, None ) = local. pat . kind
75
75
&& !in_external_macro ( cx. sess ( ) , local. span )
76
76
&& let Some ( init) = get_vec_init_kind ( cx, init_expr)
77
- && !matches ! ( init, VecInitKind :: WithExprCapacity ( _)
78
- | VecInitKind :: WithConstCapacity ( _)
79
- )
77
+ && !matches ! ( init, VecInitKind :: WithExprCapacity ( _) | VecInitKind :: WithConstCapacity ( _) )
80
78
{
81
79
self . searcher = Some ( VecReserveSearcher {
82
80
local_id : id,
@@ -93,13 +91,10 @@ impl<'tcx> LateLintPass<'tcx> for ReserveAfterInitialization {
93
91
if self . searcher . is_none ( )
94
92
&& let ExprKind :: Assign ( left, right, _) = expr. kind
95
93
&& let ExprKind :: Path ( QPath :: Resolved ( None , path) ) = left. kind
96
- && let [ _] = & path. segments
97
94
&& let Res :: Local ( id) = path. res
98
95
&& !in_external_macro ( cx. sess ( ) , expr. span )
99
96
&& let Some ( init) = get_vec_init_kind ( cx, right)
100
- && !matches ! ( init, VecInitKind :: WithExprCapacity ( _)
101
- | VecInitKind :: WithConstCapacity ( _)
102
- )
97
+ && !matches ! ( init, VecInitKind :: WithExprCapacity ( _) | VecInitKind :: WithConstCapacity ( _) )
103
98
{
104
99
self . searcher = Some ( VecReserveSearcher {
105
100
local_id : id,
@@ -122,7 +117,7 @@ impl<'tcx> LateLintPass<'tcx> for ReserveAfterInitialization {
122
117
{
123
118
self . searcher = Some ( VecReserveSearcher {
124
119
err_span : searcher. err_span . to ( stmt. span ) ,
125
- space_hint : snippet ( cx, space_hint. span , ".." ) . to_string ( ) ,
120
+ space_hint : snippet ( cx, space_hint. span , ".." ) . into_owned ( ) ,
126
121
.. searcher
127
122
} ) ;
128
123
} else {
0 commit comments