Skip to content

Commit 73a443d

Browse files
committed
Auto merge of rust-lang#7871 - camsteffen:fmt-update, r=camsteffen
Update rustfmt changelog: none Something changed with `rustup update nightly`
2 parents ba0cfc7 + 20fb7f2 commit 73a443d

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_utils/src/higher.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -770,13 +770,13 @@ pub fn get_vec_init_kind<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) -
770770
}
771771
return Some(VecInitKind::WithExprCapacity(arg.hir_id));
772772
}
773-
}
773+
},
774774
ExprKind::Path(QPath::Resolved(_, path))
775775
if match_def_path(cx, path.res.opt_def_id()?, &paths::DEFAULT_TRAIT_METHOD)
776776
&& is_type_diagnostic_item(cx, cx.typeck_results().expr_ty(expr), sym::Vec) =>
777777
{
778778
return Some(VecInitKind::Default);
779-
}
779+
},
780780
_ => (),
781781
}
782782
}

clippy_utils/src/lib.rs

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

846846
for (parent_id, parent) in cx.tcx.hir().parent_iter(e.hir_id) {
847-
if let [Adjustment {
848-
kind: Adjust::Deref(_) | Adjust::Borrow(AutoBorrow::Ref(..)),
849-
target,
850-
}, ref adjust @ ..] = *cx
847+
if let [
848+
Adjustment {
849+
kind: Adjust::Deref(_) | Adjust::Borrow(AutoBorrow::Ref(..)),
850+
target,
851+
},
852+
ref adjust @ ..,
853+
] = *cx
851854
.typeck_results()
852855
.adjustments()
853856
.get(child_id)
@@ -1232,9 +1235,7 @@ pub fn get_enclosing_loop_or_closure(tcx: TyCtxt<'tcx>, expr: &Expr<'_>) -> Opti
12321235
for (_, node) in tcx.hir().parent_iter(expr.hir_id) {
12331236
match node {
12341237
Node::Expr(
1235-
e
1236-
@
1237-
Expr {
1238+
e @ Expr {
12381239
kind: ExprKind::Loop(..) | ExprKind::Closure(..),
12391240
..
12401241
},
@@ -1692,10 +1693,12 @@ pub fn is_async_fn(kind: FnKind<'_>) -> bool {
16921693
pub fn get_async_fn_body(tcx: TyCtxt<'tcx>, body: &Body<'_>) -> Option<&'tcx Expr<'tcx>> {
16931694
if let ExprKind::Call(
16941695
_,
1695-
&[Expr {
1696-
kind: ExprKind::Closure(_, _, body, _, _),
1697-
..
1698-
}],
1696+
&[
1697+
Expr {
1698+
kind: ExprKind::Closure(_, _, body, _, _),
1699+
..
1700+
},
1701+
],
16991702
) = body.value.kind
17001703
{
17011704
if let ExprKind::Block(

0 commit comments

Comments
 (0)