Skip to content

Commit d23a338

Browse files
committed
Format backport to pass CI
1 parent e1225bf commit d23a338

File tree

11 files changed

+54
-41
lines changed

11 files changed

+54
-41
lines changed

clippy_lints/src/dereference.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ impl<'tcx> LateLintPass<'tcx> for Dereferencing {
126126
target_mut,
127127
},
128128
));
129-
}
129+
},
130130
_ => (),
131131
}
132132
},

clippy_lints/src/entry.rs

+8-5
Original file line numberDiff line numberDiff line change
@@ -245,11 +245,14 @@ fn try_parse_contains(cx: &LateContext<'_>, expr: &'tcx Expr<'_>) -> Option<(Map
245245
ExprKind::MethodCall(
246246
_,
247247
_,
248-
[map, Expr {
249-
kind: ExprKind::AddrOf(_, _, key),
250-
span: key_span,
251-
..
252-
}],
248+
[
249+
map,
250+
Expr {
251+
kind: ExprKind::AddrOf(_, _, key),
252+
span: key_span,
253+
..
254+
},
255+
],
253256
_,
254257
) if key_span.ctxt() == expr.span.ctxt() => {
255258
let id = cx.typeck_results().type_dependent_def_id(expr.hir_id)?;

clippy_lints/src/eta_reduction.rs

+10-7
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,16 @@ fn check_inputs(cx: &LateContext<'_>, params: &[Param<'_>], call_args: &[Expr<'_
169169
}
170170
match *cx.typeck_results().expr_adjustments(arg) {
171171
[] => true,
172-
[Adjustment {
173-
kind: Adjust::Deref(None),
174-
..
175-
}, Adjustment {
176-
kind: Adjust::Borrow(AutoBorrow::Ref(_, mu2)),
177-
..
178-
}] => {
172+
[
173+
Adjustment {
174+
kind: Adjust::Deref(None),
175+
..
176+
},
177+
Adjustment {
178+
kind: Adjust::Borrow(AutoBorrow::Ref(_, mu2)),
179+
..
180+
},
181+
] => {
179182
// re-borrow with the same mutability is allowed
180183
let ty = cx.typeck_results().expr_ty(arg);
181184
matches!(*ty.kind(), ty::Ref(.., mu1) if mu1 == mu2.into())

clippy_lints/src/int_plus_one.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ impl IntPlusOne {
8989
},
9090
_ => None,
9191
}
92-
}
92+
},
9393
// case where `x + 1 <= ...` or `1 + x <= ...`
9494
(BinOpKind::Le, &ExprKind::Binary(ref lhskind, ref lhslhs, ref lhsrhs), _)
9595
if lhskind.node == BinOpKind::Add =>
@@ -104,7 +104,7 @@ impl IntPlusOne {
104104
},
105105
_ => None,
106106
}
107-
}
107+
},
108108
// case where `... >= y - 1` or `... >= -1 + y`
109109
(BinOpKind::Le, _, &ExprKind::Binary(ref rhskind, ref rhslhs, ref rhsrhs)) => {
110110
match (rhskind.node, &rhslhs.kind, &rhsrhs.kind) {

clippy_lints/src/loops/utils.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ pub(super) fn make_iterator_snippet(cx: &LateContext<'_>, arg: &Expr<'_>, applic
338338
sugg::Sugg::hir_with_applicability(cx, arg_inner, "_", applic_ref).maybe_par(),
339339
meth_name,
340340
)
341-
}
341+
},
342342
_ => format!(
343343
"{}.into_iter()",
344344
sugg::Sugg::hir_with_applicability(cx, arg, "_", applic_ref).maybe_par()

clippy_lints/src/methods/clone_on_copy.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, method_name: Symbol,
8585
if expr.hir_id == self_arg.hir_id && ty != cx.typeck_results().expr_ty_adjusted(expr) =>
8686
{
8787
return;
88-
}
88+
},
8989
ExprKind::MethodCall(_, _, [self_arg, ..], _) if expr.hir_id == self_arg.hir_id => true,
9090
ExprKind::Match(_, _, MatchSource::TryDesugar | MatchSource::AwaitDesugar)
9191
| ExprKind::Field(..)
@@ -100,7 +100,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, method_name: Symbol,
100100
) =>
101101
{
102102
return;
103-
}
103+
},
104104
_ => false,
105105
};
106106

clippy_lints/src/methods/or_fun_call.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ pub(super) fn check<'tcx>(
186186
check_general_case(cx, name, method_span, &args[0], &args[1], expr.span, None);
187187
}
188188
}
189-
}
189+
},
190190
_ => (),
191191
}
192192
}

clippy_lints/src/module_style.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ impl EarlyLintPass for ModStyle {
106106
}
107107
process_paths_for_mod_files(path, &mut folder_segments, &mut mod_folders);
108108
check_self_named_mod_exists(cx, path, file);
109-
}
109+
},
110110
_ => {},
111111
}
112112
}

clippy_lints/src/needless_borrow.rs

+12-8
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,18 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessBorrow {
107107
if let ExprKind::AddrOf(BorrowKind::Ref, mutability, inner) = e.kind {
108108
if let ty::Ref(_, ty, _) = cx.typeck_results().expr_ty(inner).kind() {
109109
for adj3 in cx.typeck_results().expr_adjustments(e).windows(3) {
110-
if let [Adjustment {
111-
kind: Adjust::Deref(_), ..
112-
}, Adjustment {
113-
kind: Adjust::Deref(_), ..
114-
}, Adjustment {
115-
kind: Adjust::Borrow(_),
116-
..
117-
}] = *adj3
110+
if let [
111+
Adjustment {
112+
kind: Adjust::Deref(_), ..
113+
},
114+
Adjustment {
115+
kind: Adjust::Deref(_), ..
116+
},
117+
Adjustment {
118+
kind: Adjust::Borrow(_),
119+
..
120+
},
121+
] = *adj3
118122
{
119123
let help_msg_ty = if matches!(mutability, Mutability::Not) {
120124
format!("&{}", ty)

clippy_lints/src/vec_init_then_push.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,13 @@ fn get_vec_init_kind<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) -> Op
174174
}
175175
});
176176
}
177-
}
177+
},
178178
ExprKind::Path(QPath::Resolved(_, path))
179179
if match_def_path(cx, path.res.opt_def_id()?, &paths::DEFAULT_TRAIT_METHOD)
180180
&& is_type_diagnostic_item(cx, cx.typeck_results().expr_ty(expr), sym::Vec) =>
181181
{
182182
return Some(VecInitKind::New);
183-
}
183+
},
184184
_ => (),
185185
}
186186
}

clippy_utils/src/lib.rs

+14-11
Original file line numberDiff line numberDiff line change
@@ -846,10 +846,13 @@ pub fn capture_local_usage(cx: &LateContext<'tcx>, e: &Expr<'_>) -> CaptureKind
846846
let mut capture_expr_ty = e;
847847

848848
for (parent_id, parent) in cx.tcx.hir().parent_iter(e.hir_id) {
849-
if let [Adjustment {
850-
kind: Adjust::Deref(_) | Adjust::Borrow(AutoBorrow::Ref(..)),
851-
target,
852-
}, ref adjust @ ..] = *cx
849+
if let [
850+
Adjustment {
851+
kind: Adjust::Deref(_) | Adjust::Borrow(AutoBorrow::Ref(..)),
852+
target,
853+
},
854+
ref adjust @ ..,
855+
] = *cx
853856
.typeck_results()
854857
.adjustments()
855858
.get(child_id)
@@ -1234,9 +1237,7 @@ pub fn get_enclosing_loop_or_closure(tcx: TyCtxt<'tcx>, expr: &Expr<'_>) -> Opti
12341237
for (_, node) in tcx.hir().parent_iter(expr.hir_id) {
12351238
match node {
12361239
Node::Expr(
1237-
e
1238-
@
1239-
Expr {
1240+
e @ Expr {
12401241
kind: ExprKind::Loop(..) | ExprKind::Closure(..),
12411242
..
12421243
},
@@ -1698,10 +1699,12 @@ pub fn is_async_fn(kind: FnKind<'_>) -> bool {
16981699
pub fn get_async_fn_body(tcx: TyCtxt<'tcx>, body: &Body<'_>) -> Option<&'tcx Expr<'tcx>> {
16991700
if let ExprKind::Call(
17001701
_,
1701-
&[Expr {
1702-
kind: ExprKind::Closure(_, _, body, _, _),
1703-
..
1704-
}],
1702+
&[
1703+
Expr {
1704+
kind: ExprKind::Closure(_, _, body, _, _),
1705+
..
1706+
},
1707+
],
17051708
) = body.value.kind
17061709
{
17071710
if let ExprKind::Block(

0 commit comments

Comments
 (0)