X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=clippy_lints%2Fsrc%2Fbytecount.rs;h=278d043732f4942631731dda65e2f96873ee47e6;hb=31c84e50772e1ebdd5ace0f4211d050e193e1e90;hp=bab6a657b32fa5010eacc905a3863d45e214f1c4;hpb=39947992b57239de6581c9761dfad7ac3cf001c8;p=rust.git diff --git a/clippy_lints/src/bytecount.rs b/clippy_lints/src/bytecount.rs index bab6a657b32..278d043732f 100644 --- a/clippy_lints/src/bytecount.rs +++ b/clippy_lints/src/bytecount.rs @@ -3,12 +3,13 @@ span_lint_and_sugg, walk_ptrs_ty, }; use if_chain::if_chain; -use rustc::lint::{LateContext, LateLintPass}; -use rustc::ty; +use rustc_ast::ast::{UintTy}; use rustc_errors::Applicability; -use rustc_hir::*; +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 syntax::ast::{Name, UintTy}; +use rustc_span::Symbol; declare_clippy_lint! { /// **What it does:** Checks for naive byte counts @@ -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 { +fn get_path_name(expr: &Expr<'_>) -> Option { match expr.kind { ExprKind::Box(ref e) | ExprKind::AddrOf(BorrowKind::Ref, _, ref e) | ExprKind::Unary(UnOp::UnDeref, ref e) => { get_path_name(e)