From fe151ebb9c4f50bfed11b63b7e264005ac6bbc65 Mon Sep 17 00:00:00 2001 From: Konrad Borowski Date: Sat, 29 Dec 2018 17:31:32 +0100 Subject: [PATCH] Use match ergonomics for bit_mask lint --- clippy_lints/src/bit_mask.rs | 12 ++++++------ 1 file 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; }