-impl LintPass for NegMultiply {
- fn get_lints(&self) -> LintArray {
- lint_array!(NEG_MULTIPLY)
- }
-}
-
-#[allow(match_same_arms)]
-impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NegMultiply {
- fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) {
- if let ExprKind::Binary(Spanned { node: BinOpKind::Mul, .. }, ref l, ref r) = e.node {
- match (&l.node, &r.node) {
- (&ExprKind::Unary(..), &ExprKind::Unary(..)) => (),
- (&ExprKind::Unary(UnNeg, ref lit), _) => check_mul(cx, e.span, lit, r),
- (_, &ExprKind::Unary(UnNeg, ref lit)) => check_mul(cx, e.span, lit, l),
- _ => (),
+#[allow(clippy::match_same_arms)]
+impl<'tcx> LateLintPass<'tcx> for NegMultiply {
+ fn check_expr(&mut self, cx: &LateContext<'tcx>, e: &'tcx Expr<'_>) {
+ if let ExprKind::Binary(ref op, ref left, ref right) = e.kind {
+ if BinOpKind::Mul == op.node {
+ match (&left.kind, &right.kind) {
+ (&ExprKind::Unary(..), &ExprKind::Unary(..)) => {},
+ (&ExprKind::Unary(UnOp::Neg, ref lit), _) => check_mul(cx, e.span, lit, right),
+ (_, &ExprKind::Unary(UnOp::Neg, ref lit)) => check_mul(cx, e.span, lit, left),
+ _ => {},
+ }