]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/erasing_op.rs
Merge branch 'macro-use' into HEAD
[rust.git] / clippy_lints / src / erasing_op.rs
index 9cd4f3ada3bb21ca3e74ed8966f2394713db1947..102769a375e18d9a40b6f51ac4b8c65af662de83 100644 (file)
@@ -1,8 +1,9 @@
-use consts::{constant_simple, Constant};
+use crate::consts::{constant_simple, Constant};
 use rustc::hir::*;
 use rustc::lint::*;
+use rustc::{declare_lint, lint_array};
 use syntax::codemap::Span;
-use utils::{in_macro, span_lint};
+use crate::utils::{in_macro, span_lint};
 
 /// **What it does:** Checks for erasing operations, e.g. `x * 0`.
 ///
@@ -36,13 +37,13 @@ fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) {
         if in_macro(e.span) {
             return;
         }
-        if let ExprBinary(ref cmp, ref left, ref right) = e.node {
+        if let ExprKind::Binary(ref cmp, ref left, ref right) = e.node {
             match cmp.node {
-                BiMul | BiBitAnd => {
+                BinOpKind::Mul | BinOpKind::BitAnd => {
                     check(cx, left, e.span);
                     check(cx, right, e.span);
                 },
-                BiDiv => check(cx, left, e.span),
+                BinOpKind::Div => check(cx, left, e.span),
                 _ => (),
             }
         }
@@ -50,7 +51,7 @@ fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) {
 }
 
 fn check(cx: &LateContext, e: &Expr, span: Span) {
-    if let Some(Constant::Int(v)) = constant_simple(cx, e) {
+    if let Some(Constant::Int(v)) = constant_simple(cx, cx.tables, e) {
         if v == 0 {
             span_lint(
                 cx,