From 9494f22f06f29ed1c47314b10ed62cfc1d4aff80 Mon Sep 17 00:00:00 2001 From: Philipp Hansch Date: Fri, 8 Mar 2019 09:44:22 +0100 Subject: [PATCH] cargo fmt --- clippy_lints/src/assign_ops.rs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/clippy_lints/src/assign_ops.rs b/clippy_lints/src/assign_ops.rs index 63ec98a5b3a..83bfd53017f 100644 --- a/clippy_lints/src/assign_ops.rs +++ b/clippy_lints/src/assign_ops.rs @@ -68,7 +68,9 @@ fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx hir::Expr) { match &expr.node { hir::ExprKind::AssignOp(op, lhs, rhs) => { if let hir::ExprKind::Binary(binop, l, r) = &rhs.node { - if op.node != binop.node { return; } + if op.node != binop.node { + return; + } // lhs op= l op r if SpanlessEq::new(cx).ignore_fn().eq_expr(lhs, l) { lint_misrefactored_assign_op(cx, expr, *op, rhs, lhs, r); @@ -196,20 +198,24 @@ macro_rules! ops { } } -fn lint_misrefactored_assign_op(cx: &LateContext<'_, '_>, expr: &hir::Expr, op: hir::BinOp, rhs: &hir::Expr, assignee: &hir::Expr, rhs_other: &hir::Expr) { +fn lint_misrefactored_assign_op( + cx: &LateContext<'_, '_>, + expr: &hir::Expr, + op: hir::BinOp, + rhs: &hir::Expr, + assignee: &hir::Expr, + rhs_other: &hir::Expr, +) { span_lint_and_then( cx, MISREFACTORED_ASSIGN_OP, expr.span, "variable appears on both sides of an assignment operation", |db| { - if let (Some(snip_a), Some(snip_r)) = - (snippet_opt(cx, assignee.span), snippet_opt(cx, rhs_other.span)) - { + if let (Some(snip_a), Some(snip_r)) = (snippet_opt(cx, assignee.span), snippet_opt(cx, rhs_other.span)) { let a = &sugg::Sugg::hir(cx, assignee, ".."); let r = &sugg::Sugg::hir(cx, rhs, ".."); - let long = - format!("{} = {}", snip_a, sugg::make_binop(higher::binop(op.node), a, r)); + let long = format!("{} = {}", snip_a, sugg::make_binop(higher::binop(op.node), a, r)); db.span_suggestion( expr.span, &format!(