Skip to content

Commit fe151eb

Browse files
committed
Use match ergonomics for bit_mask lint
1 parent 931e2b0 commit fe151eb

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

clippy_lints/src/bit_mask.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl LintPass for BitMask {
121121

122122
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BitMask {
123123
fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) {
124-
if let ExprKind::Binary(ref cmp, ref left, ref right) = e.node {
124+
if let ExprKind::Binary(cmp, left, right) = &e.node {
125125
if cmp.node.is_comparison() {
126126
if let Some(cmp_opt) = fetch_int_literal(cx, right) {
127127
check_compare(cx, left, cmp.node, cmp_opt, e.span)
@@ -131,13 +131,13 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BitMask {
131131
}
132132
}
133133
if_chain! {
134-
if let ExprKind::Binary(ref op, ref left, ref right) = e.node;
134+
if let ExprKind::Binary(op, left, right) = &e.node;
135135
if BinOpKind::Eq == op.node;
136-
if let ExprKind::Binary(ref op1, ref left1, ref right1) = left.node;
136+
if let ExprKind::Binary(op1, left1, right1) = &left.node;
137137
if BinOpKind::BitAnd == op1.node;
138-
if let ExprKind::Lit(ref lit) = right1.node;
138+
if let ExprKind::Lit(lit) = &right1.node;
139139
if let LitKind::Int(n, _) = lit.node;
140-
if let ExprKind::Lit(ref lit1) = right.node;
140+
if let ExprKind::Lit(lit1) = &right.node;
141141
if let LitKind::Int(0, _) = lit1.node;
142142
if n.leading_zeros() == n.count_zeros();
143143
if n > u128::from(self.verbose_bit_mask_threshold);
@@ -173,7 +173,7 @@ fn invert_cmp(cmp: BinOpKind) -> BinOpKind {
173173
}
174174

175175
fn check_compare(cx: &LateContext<'_, '_>, bit_op: &Expr, cmp_op: BinOpKind, cmp_value: u128, span: Span) {
176-
if let ExprKind::Binary(ref op, ref left, ref right) = bit_op.node {
176+
if let ExprKind::Binary(op, left, right) = &bit_op.node {
177177
if op.node != BinOpKind::BitAnd && op.node != BinOpKind::BitOr {
178178
return;
179179
}

0 commit comments

Comments
 (0)