]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/modulo_arithmetic.rs
modify code
[rust.git] / clippy_lints / src / modulo_arithmetic.rs
index 2d14943b56c95fbffbb2d20ddd8c2a4bfbf9897b..d182a7d52497d45fd59cf8d367f8e84e207d3e10 100644 (file)
@@ -24,6 +24,7 @@
     /// ```rust
     /// let x = -17 % 3;
     /// ```
+    #[clippy::version = "1.42.0"]
     pub MODULO_ARITHMETIC,
     restriction,
     "any modulo arithmetic statement"
@@ -128,7 +129,7 @@ impl<'tcx> LateLintPass<'tcx> for ModuloArithmetic {
     fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
         match &expr.kind {
             ExprKind::Binary(op, lhs, rhs) | ExprKind::AssignOp(op, lhs, rhs) => {
-                if let BinOpKind::Rem = op.node {
+                if op.node == BinOpKind::Rem {
                     let lhs_operand = analyze_operand(lhs, cx, expr);
                     let rhs_operand = analyze_operand(rhs, cx, expr);
                     if_chain! {