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
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);
}
}
-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(_, ref e) | ExprKind::Unary(UnOp::UnDeref, ref e) => get_path_name(e),
+ ExprKind::Box(ref e) | ExprKind::AddrOf(BorrowKind::Ref, _, ref e) | ExprKind::Unary(UnOp::UnDeref, ref e) => {
+ get_path_name(e)
+ },
ExprKind::Block(ref b, _) => {
if b.stmts.is_empty() {
b.expr.as_ref().and_then(|p| get_path_name(p))