Skip to content

Commit e9a222b

Browse files
committed
Minor changes
1 parent 7977d20 commit e9a222b

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

clippy_lints/src/reserve_after_initialization.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@ impl<'tcx> LateLintPass<'tcx> for ReserveAfterInitialization {
7474
&& let PatKind::Binding(BindingAnnotation::MUT, id, _, None) = local.pat.kind
7575
&& !in_external_macro(cx.sess(), local.span)
7676
&& 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(_))
8078
{
8179
self.searcher = Some(VecReserveSearcher {
8280
local_id: id,
@@ -93,13 +91,10 @@ impl<'tcx> LateLintPass<'tcx> for ReserveAfterInitialization {
9391
if self.searcher.is_none()
9492
&& let ExprKind::Assign(left, right, _) = expr.kind
9593
&& let ExprKind::Path(QPath::Resolved(None, path)) = left.kind
96-
&& let [_] = &path.segments
9794
&& let Res::Local(id) = path.res
9895
&& !in_external_macro(cx.sess(), expr.span)
9996
&& 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(_))
10398
{
10499
self.searcher = Some(VecReserveSearcher {
105100
local_id: id,
@@ -122,7 +117,7 @@ impl<'tcx> LateLintPass<'tcx> for ReserveAfterInitialization {
122117
{
123118
self.searcher = Some(VecReserveSearcher {
124119
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(),
126121
.. searcher
127122
});
128123
} else {

0 commit comments

Comments
 (0)