]> git.lizzy.rs Git - rust.git/commitdiff
Add the other overloadable operations to suspicious_arithmetic_impl
authorRyan Wiedemann <Ryan1729@gmail.com>
Mon, 10 Aug 2020 13:30:55 +0000 (07:30 -0600)
committerRyan1729 <Ryan1729@gmail.com>
Wed, 12 Aug 2020 16:33:16 +0000 (10:33 -0600)
In #2268 I idly mused that the other user-overloadable operations could be added to this lint. Knowing that the lint was arguably incomplete was gnawing at the back of my mind, so I figured that I might as well make this PR, particularly given the change needed was so small.

clippy_lints/src/suspicious_trait_impl.rs

index 4e335a0222f2067c3fd33e05f9bed56c5fa91bff..e026f27d9a7beaa0a3d06c32548c630eea412487 100644 (file)
@@ -86,12 +86,18 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>) {
                 cx,
                 expr,
                 binop.node,
-                &["Add", "Sub", "Mul", "Div"],
+                &["Add", "Sub", "Mul", "Div", "Rem", "BitAnd", "BitOr", "BitXor", "Shl", "Shr"],
                 &[
                     hir::BinOpKind::Add,
                     hir::BinOpKind::Sub,
                     hir::BinOpKind::Mul,
                     hir::BinOpKind::Div,
+                    hir::BinOpKind::Rem,
+                    hir::BinOpKind::BitAnd,
+                    hir::BinOpKind::BitOr,
+                    hir::BinOpKind::BitXor,
+                    hir::BinOpKind::Shl,
+                    hir::BinOpKind::Shr,
                 ],
             ) {
                 span_lint(