mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-11 07:34:18 +00:00
Small cleanup
This commit is contained in:
parent
344698377f
commit
a9e1b1fba0
1 changed files with 4 additions and 9 deletions
|
@ -54,15 +54,10 @@ impl LateLintPass for CopyAndPaste {
|
|||
/// Implementation of `IF_SAME_THEN_ELSE`.
|
||||
fn lint_same_then_else(cx: &LateContext, expr: &Expr) {
|
||||
if let ExprIf(_, ref then_block, Some(ref else_expr)) = expr.node {
|
||||
let must_lint = if let ExprBlock(ref else_block) = else_expr.node {
|
||||
is_block_equal(cx, &then_block, &else_block, false)
|
||||
}
|
||||
else {
|
||||
false
|
||||
};
|
||||
|
||||
if must_lint {
|
||||
span_lint(cx, IF_SAME_THEN_ELSE, expr.span, "this if has the same then and else blocks");
|
||||
if let ExprBlock(ref else_block) = else_expr.node {
|
||||
if is_block_equal(cx, &then_block, &else_block, false) {
|
||||
span_lint(cx, IF_SAME_THEN_ELSE, expr.span, "this if has the same then and else blocks");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue