X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=clippy_lints%2Fsrc%2Fmissing_inline.rs;h=22b56c28b6bc1aa018c2ae15dccef612f998ba12;hb=2ff568d746e4641b992c0b74bea046e43a637997;hp=dab5bee3ffe70c6d9a04e1a009a575218964c192;hpb=c5178e82b4ed8fd9210e382dcd2735d438957434;p=rust.git diff --git a/clippy_lints/src/missing_inline.rs b/clippy_lints/src/missing_inline.rs index dab5bee3ffe..22b56c28b6b 100644 --- a/clippy_lints/src/missing_inline.rs +++ b/clippy_lints/src/missing_inline.rs @@ -1,10 +1,9 @@ use crate::utils::span_lint; -use rustc::declare_lint_pass; -use rustc::hir; -use rustc::lint::{self, LateContext, LateLintPass, LintArray, LintContext, LintPass}; -use rustc_session::declare_tool_lint; +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, @@ -54,7 +53,7 @@ /// ``` pub MISSING_INLINE_IN_PUBLIC_ITEMS, restriction, - "detects missing #[inline] attribute for public callables (functions, trait methods, methods...)" + "detects missing `#[inline]` attribute for public callables (functions, trait methods, methods...)" } fn check_missing_inline_attrs(cx: &LateContext<'_, '_>, attrs: &[ast::Attribute], sp: Span, desc: &'static str) { @@ -70,7 +69,7 @@ fn check_missing_inline_attrs(cx: &LateContext<'_, '_>, attrs: &[ast::Attribute] } 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, @@ -82,7 +81,7 @@ fn is_executable(cx: &LateContext<'_, '_>) -> bool { 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; } @@ -101,7 +100,7 @@ fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, it: &'tcx hir::Item<'_>) { 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 @@ -125,14 +124,14 @@ fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, it: &'tcx hir::Item<'_>) { | 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; } @@ -142,7 +141,7 @@ fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, impl_item: &'tcx hir:: } 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, };