]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/bytecount.rs
Fix clippy.
[rust.git] / clippy_lints / src / bytecount.rs
index f53f5f3e90479a799fd94dd511475e2f7f783e8f..278d043732f4942631731dda65e2f96873ee47e6 100644 (file)
@@ -3,12 +3,13 @@
     span_lint_and_sugg, walk_ptrs_ty,
 };
 use if_chain::if_chain;
-use rustc::hir::*;
-use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
-use rustc::ty;
-use rustc::{declare_lint_pass, declare_tool_lint};
+use rustc_ast::ast::{UintTy};
 use rustc_errors::Applicability;
-use syntax::ast::{Name, UintTy};
+use rustc_hir::{BinOpKind, BorrowKind, Expr, ExprKind, UnOp};
+use rustc_lint::{LateContext, LateLintPass};
+use rustc_middle::ty;
+use rustc_session::{declare_lint_pass, declare_tool_lint};
+use rustc_span::Symbol;
 
 declare_clippy_lint! {
     /// **What it does:** Checks for naive byte counts
@@ -35,7 +36,7 @@
 declare_lint_pass!(ByteCount => [NAIVE_BYTECOUNT]);
 
 impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ByteCount {
-    fn check_expr(&mut self, cx: &LateContext<'_, '_>, expr: &Expr) {
+    fn check_expr(&mut self, cx: &LateContext<'_, '_>, expr: &Expr<'_>) {
         if_chain! {
             if let ExprKind::MethodCall(ref count, _, ref count_args) = expr.kind;
             if count.ident.name == sym!(count);
@@ -95,11 +96,11 @@ fn check_expr(&mut self, cx: &LateContext<'_, '_>, expr: &Expr) {
     }
 }
 
-fn check_arg(name: Name, arg: Name, needle: &Expr) -> bool {
+fn check_arg(name: Symbol, arg: Symbol, needle: &Expr<'_>) -> bool {
     name == arg && !contains_name(name, needle)
 }
 
-fn get_path_name(expr: &Expr) -> Option<Name> {
+fn get_path_name(expr: &Expr<'_>) -> Option<Symbol> {
     match expr.kind {
         ExprKind::Box(ref e) | ExprKind::AddrOf(BorrowKind::Ref, _, ref e) | ExprKind::Unary(UnOp::UnDeref, ref e) => {
             get_path_name(e)