use crate::utils::span_lint;
-use rustc::lint::{self, LateContext, LateLintPass, LintContext};
+use rustc_ast::ast;
use rustc_hir as hir;
+use rustc_lint::{self, LateContext, LateLintPass, LintContext};
use rustc_session::{declare_lint_pass, declare_tool_lint};
use rustc_span::source_map::Span;
-use syntax::ast;
declare_clippy_lint! {
/// **What it does:** it lints if an exported function, method, trait method with default impl,
}
fn is_executable(cx: &LateContext<'_, '_>) -> bool {
- use rustc::session::config::CrateType;
+ use rustc_session::config::CrateType;
cx.tcx.sess.crate_types.get().iter().any(|t: &CrateType| match t {
CrateType::Executable => true,
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingInline {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, it: &'tcx hir::Item<'_>) {
- if lint::in_external_macro(cx.sess(), it.span) || is_executable(cx) {
+ if rustc::lint::in_external_macro(cx.sess(), it.span) || is_executable(cx) {
return;
}
let tit_ = cx.tcx.hir().trait_item(tit.id);
match tit_.kind {
hir::TraitItemKind::Const(..) | hir::TraitItemKind::Type(..) => {},
- hir::TraitItemKind::Method(..) => {
+ hir::TraitItemKind::Fn(..) => {
if tit.defaultness.has_value() {
// trait method with default body needs inline in case
// an impl is not provided
| hir::ItemKind::OpaqueTy(..)
| hir::ItemKind::ExternCrate(..)
| hir::ItemKind::ForeignMod(..)
- | hir::ItemKind::Impl(..)
+ | hir::ItemKind::Impl { .. }
| hir::ItemKind::Use(..) => {},
};
}
fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, impl_item: &'tcx hir::ImplItem<'_>) {
use rustc::ty::{ImplContainer, TraitContainer};
- if lint::in_external_macro(cx.sess(), impl_item.span) || is_executable(cx) {
+ if rustc::lint::in_external_macro(cx.sess(), impl_item.span) || is_executable(cx) {
return;
}
}
let desc = match impl_item.kind {
- hir::ImplItemKind::Method(..) => "a method",
+ hir::ImplItemKind::Fn(..) => "a method",
hir::ImplItemKind::Const(..) | hir::ImplItemKind::TyAlias(_) | hir::ImplItemKind::OpaqueTy(_) => return,
};