apply rustfmt

This commit is contained in:
Oliver Schneider
2017-01-17 19:30:32 +01:00
parent 7b836dd27c
commit 713da45906
21 changed files with 101 additions and 129 deletions

View File

@@ -94,14 +94,12 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssignOps {
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.span)) {
db.span_suggestion(expr.span,
|db| if let (Some(snip_a), Some(snip_r)) =
(snippet_opt(cx, assignee.span), snippet_opt(cx, rhs.span)) {
db.span_suggestion(expr.span,
"replace it with",
format!("{} {}= {}", snip_a, op.node.as_str(), snip_r));
}
});
});
};
// lhs op= l op r
if SpanlessEq::new(cx).ignore_fn().eq_expr(lhs, l) {
@@ -177,14 +175,12 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssignOps {
ASSIGN_OP_PATTERN,
expr.span,
"manual implementation of an assign operation",
|db| {
if let (Some(snip_a), Some(snip_r)) =
(snippet_opt(cx, assignee.span), snippet_opt(cx, rhs.span)) {
db.span_suggestion(expr.span,
|db| if let (Some(snip_a), Some(snip_r)) =
(snippet_opt(cx, assignee.span), snippet_opt(cx, rhs.span)) {
db.span_suggestion(expr.span,
"replace it with",
format!("{} {}= {}", snip_a, op.node.as_str(), snip_r));
}
});
});
}
};
// a = a op b