diff options
| author | Konrad Borowski <konrad@borowski.pw> | 2018-12-29 17:32:09 +0100 |
|---|---|---|
| committer | Konrad Borowski <konrad@borowski.pw> | 2018-12-29 17:32:09 +0100 |
| commit | 13c857b74509a7f1cd80e69f4b7938a21e848ae3 (patch) | |
| tree | b77333aa89d22e28f60174c2a0908ff0b7810d27 | |
| parent | fe151ebb9c4f50bfed11b63b7e264005ac6bbc65 (diff) | |
| download | rust-13c857b74509a7f1cd80e69f4b7938a21e848ae3.tar.gz rust-13c857b74509a7f1cd80e69f4b7938a21e848ae3.zip | |
Use match ergonomics for block_in_if_condition lint
| -rw-r--r-- | clippy_lints/src/block_in_if_condition.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/clippy_lints/src/block_in_if_condition.rs b/clippy_lints/src/block_in_if_condition.rs index 825bf789a69..d288c45639d 100644 --- a/clippy_lints/src/block_in_if_condition.rs +++ b/clippy_lints/src/block_in_if_condition.rs @@ -88,11 +88,11 @@ const COMPLEX_BLOCK_MESSAGE: &str = "in an 'if' condition, avoid complex blocks impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BlockInIfCondition { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { - if let ExprKind::If(ref check, ref then, _) = expr.node { - if let ExprKind::Block(ref block, _) = check.node { + if let ExprKind::If(check, then, _) = &expr.node { + if let ExprKind::Block(block, _) = &check.node { if block.rules == DefaultBlock { if block.stmts.is_empty() { - if let Some(ref ex) = block.expr { + if let Some(ex) = &block.expr { // don't dig into the expression here, just suggest that they remove // the block if in_macro(expr.span) || differing_macro_contexts(expr.span, ex.span) { |
