diff options
| author | Konrad Borowski <konrad@borowski.pw> | 2018-12-29 17:31:32 +0100 |
|---|---|---|
| committer | Konrad Borowski <konrad@borowski.pw> | 2018-12-29 17:31:32 +0100 |
| commit | fe151ebb9c4f50bfed11b63b7e264005ac6bbc65 (patch) | |
| tree | 1cd9a2bc34aea60892ad1ab162b03f5d4396c3d7 | |
| parent | 931e2b0026e1223f0a39bc322fd7e70d9736d09a (diff) | |
| download | rust-fe151ebb9c4f50bfed11b63b7e264005ac6bbc65.tar.gz rust-fe151ebb9c4f50bfed11b63b7e264005ac6bbc65.zip | |
Use match ergonomics for bit_mask lint
| -rw-r--r-- | clippy_lints/src/bit_mask.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/clippy_lints/src/bit_mask.rs b/clippy_lints/src/bit_mask.rs index b15ce871c32..c85ab799ddc 100644 --- a/clippy_lints/src/bit_mask.rs +++ b/clippy_lints/src/bit_mask.rs @@ -121,7 +121,7 @@ impl LintPass for BitMask { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BitMask { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { - if let ExprKind::Binary(ref cmp, ref left, ref right) = e.node { + if let ExprKind::Binary(cmp, left, right) = &e.node { if cmp.node.is_comparison() { if let Some(cmp_opt) = fetch_int_literal(cx, right) { check_compare(cx, left, cmp.node, cmp_opt, e.span) @@ -131,13 +131,13 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BitMask { } } if_chain! { - if let ExprKind::Binary(ref op, ref left, ref right) = e.node; + if let ExprKind::Binary(op, left, right) = &e.node; if BinOpKind::Eq == op.node; - if let ExprKind::Binary(ref op1, ref left1, ref right1) = left.node; + if let ExprKind::Binary(op1, left1, right1) = &left.node; if BinOpKind::BitAnd == op1.node; - if let ExprKind::Lit(ref lit) = right1.node; + if let ExprKind::Lit(lit) = &right1.node; if let LitKind::Int(n, _) = lit.node; - if let ExprKind::Lit(ref lit1) = right.node; + if let ExprKind::Lit(lit1) = &right.node; if let LitKind::Int(0, _) = lit1.node; if n.leading_zeros() == n.count_zeros(); if n > u128::from(self.verbose_bit_mask_threshold); @@ -173,7 +173,7 @@ fn invert_cmp(cmp: BinOpKind) -> BinOpKind { } fn check_compare(cx: &LateContext<'_, '_>, bit_op: &Expr, cmp_op: BinOpKind, cmp_value: u128, span: Span) { - if let ExprKind::Binary(ref op, ref left, ref right) = bit_op.node { + if let ExprKind::Binary(op, left, right) = &bit_op.node { if op.node != BinOpKind::BitAnd && op.node != BinOpKind::BitOr { return; } |
