Skip to content

Commit 6eeac46

Browse files
committed
Run rustfmt
1 parent d2d62de commit 6eeac46

File tree

4 files changed

+18
-8
lines changed

4 files changed

+18
-8
lines changed

clippy_lints/src/bytecount.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ fn check_arg(name: Name, arg: Name, needle: &Expr) -> bool {
101101

102102
fn get_path_name(expr: &Expr) -> Option<Name> {
103103
match expr.kind {
104-
ExprKind::Box(ref e) | ExprKind::AddrOf(_, _, ref e) | ExprKind::Unary(UnOp::UnDeref, ref e) => get_path_name(e),
104+
ExprKind::Box(ref e) | ExprKind::AddrOf(_, _, ref e) | ExprKind::Unary(UnOp::UnDeref, ref e) => {
105+
get_path_name(e)
106+
},
105107
ExprKind::Block(ref b, _) => {
106108
if b.stmts.is_empty() {
107109
b.expr.as_ref().and_then(|p| get_path_name(p))

clippy_lints/src/loops.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1504,7 +1504,9 @@ fn make_iterator_snippet(cx: &LateContext<'_, '_>, arg: &Expr, applic_ref: &mut
15041504
// (&x).into_iter() ==> x.iter()
15051505
// (&mut x).into_iter() ==> x.iter_mut()
15061506
match &arg.kind {
1507-
ExprKind::AddrOf(_, mutability, arg_inner) if has_iter_method(cx, cx.tables.expr_ty(&arg_inner)).is_some() => {
1507+
ExprKind::AddrOf(_, mutability, arg_inner)
1508+
if has_iter_method(cx, cx.tables.expr_ty(&arg_inner)).is_some() =>
1509+
{
15081510
let meth_name = match mutability {
15091511
Mutability::Mutable => "iter_mut",
15101512
Mutability::Immutable => "iter",
@@ -1514,7 +1516,7 @@ fn make_iterator_snippet(cx: &LateContext<'_, '_>, arg: &Expr, applic_ref: &mut
15141516
sugg::Sugg::hir_with_applicability(cx, &arg_inner, "_", applic_ref).maybe_par(),
15151517
meth_name,
15161518
)
1517-
},
1519+
}
15181520
_ => format!(
15191521
"{}.into_iter()",
15201522
sugg::Sugg::hir_with_applicability(cx, arg, "_", applic_ref).maybe_par()
@@ -2090,7 +2092,9 @@ impl<'a, 'tcx> Visitor<'tcx> for IncrementVisitor<'a, 'tcx> {
20902092
}
20912093
},
20922094
ExprKind::Assign(ref lhs, _) if lhs.hir_id == expr.hir_id => *state = VarState::DontWarn,
2093-
ExprKind::AddrOf(_, mutability, _) if mutability == Mutability::Mutable => *state = VarState::DontWarn,
2095+
ExprKind::AddrOf(_, mutability, _) if mutability == Mutability::Mutable => {
2096+
*state = VarState::DontWarn
2097+
},
20942098
_ => (),
20952099
}
20962100
}

clippy_lints/src/shadow.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,9 +313,10 @@ fn check_expr<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr, bindings:
313313
return;
314314
}
315315
match expr.kind {
316-
ExprKind::Unary(_, ref e) | ExprKind::Field(ref e, _) | ExprKind::AddrOf(_, _, ref e) | ExprKind::Box(ref e) => {
317-
check_expr(cx, e, bindings)
318-
},
316+
ExprKind::Unary(_, ref e)
317+
| ExprKind::Field(ref e, _)
318+
| ExprKind::AddrOf(_, _, ref e)
319+
| ExprKind::Box(ref e) => check_expr(cx, e, bindings),
319320
ExprKind::Block(ref block, _) | ExprKind::Loop(ref block, _, _) => check_block(cx, block, bindings),
320321
// ExprKind::Call
321322
// ExprKind::MethodCall

clippy_lints/src/utils/author.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,10 @@ impl<'tcx> Visitor<'tcx> for PrintVisitor {
427427
},
428428
ExprKind::AddrOf(_, mutability, ref inner) => {
429429
let inner_pat = self.next("inner");
430-
println!("AddrOf(_, Mutability::{:?}, ref {}) = {};", mutability, inner_pat, current);
430+
println!(
431+
"AddrOf(_, Mutability::{:?}, ref {}) = {};",
432+
mutability, inner_pat, current
433+
);
431434
self.current = inner_pat;
432435
self.visit_expr(inner);
433436
},

0 commit comments

Comments
 (0)