use rustc::lint::*;
+use rustc::{declare_lint, lint_array};
use rustc::hir::*;
+use rustc::hir;
use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
use crate::utils::{match_qpath, paths, span_lint};
use syntax::symbol::LocalInternedString;
-use syntax::ast::{Crate as AstCrate, ItemKind, Name, NodeId};
+use syntax::ast::{Crate as AstCrate, ItemKind, Name};
use syntax::codemap::Span;
use std::collections::{HashMap, HashSet};
}
impl EarlyLintPass for Clippy {
- fn check_crate(&mut self, cx: &EarlyContext, krate: &AstCrate) {
+ fn check_crate(&mut self, cx: &EarlyContext<'_>, krate: &AstCrate) {
if let Some(utils) = krate
.module
.items
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LintWithoutLintPass {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
- if let ItemStatic(ref ty, MutImmutable, body_id) = item.node {
+ if let hir::ItemKind::Static(ref ty, MutImmutable, body_id) = item.node {
if is_lint_ref_type(ty) {
self.declared_lints.insert(item.name, item.span);
- } else if is_lint_array_type(ty) && item.vis == Visibility::Inherited && item.name == "ARRAY" {
- let mut collector = LintCollector {
- output: &mut self.registered_lints,
- cx,
- };
- collector.visit_expr(&cx.tcx.hir.body(body_id).value);
+ } else if is_lint_array_type(ty) && item.name == "ARRAY" {
+ if let VisibilityKind::Inherited = item.vis.node {
+ let mut collector = LintCollector {
+ output: &mut self.registered_lints,
+ cx,
+ };
+ collector.visit_expr(&cx.tcx.hir.body(body_id).value);
+ }
}
}
}
fn is_lint_ref_type(ty: &Ty) -> bool {
- if let TyRptr(
+ if let TyKind::Rptr(
_,
MutTy {
ty: ref inner,
},
) = ty.node
{
- if let TyPath(ref path) = inner.node {
+ if let TyKind::Path(ref path) = inner.node {
return match_qpath(path, &paths::LINT);
}
}
fn is_lint_array_type(ty: &Ty) -> bool {
- if let TyPath(ref path) = ty.node {
+ if let TyKind::Path(ref path) = ty.node {
match_qpath(path, &paths::LINT_ARRAY)
} else {
false
walk_expr(self, expr);
}
- fn visit_path(&mut self, path: &'tcx Path, _: NodeId) {
+ fn visit_path(&mut self, path: &'tcx Path, _: HirId) {
if path.segments.len() == 1 {
self.output.insert(path.segments[0].ident.name);
}