]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_lint/nonstandard_style.rs
Auto merge of #68034 - Centril:rollup-3d9pq14, r=Centril
[rust.git] / src / librustc_lint / nonstandard_style.rs
index 2752be9a6de9903ff515865d8c80f330b782dc24..13e57ecf1469c4a59de3437b786bd90b903ae92a 100644 (file)
@@ -1,16 +1,17 @@
 use lint::{EarlyContext, LateContext, LintArray, LintContext};
 use lint::{EarlyLintPass, LateLintPass, LintPass};
-use rustc::hir::def::{DefKind, Res};
-use rustc::hir::intravisit::FnKind;
-use rustc::hir::{self, GenericParamKind, PatKind};
 use rustc::lint;
 use rustc::ty;
+use rustc_hir as hir;
+use rustc_hir::def::{DefKind, Res};
+use rustc_hir::intravisit::FnKind;
+use rustc_hir::{GenericParamKind, PatKind};
+use rustc_span::symbol::sym;
+use rustc_span::{symbol::Ident, BytePos, Span};
 use rustc_target::spec::abi::Abi;
 use syntax::ast;
 use syntax::attr;
 use syntax::errors::Applicability;
-use syntax::symbol::sym;
-use syntax_pos::{symbol::Ident, BytePos, Span};
 
 #[derive(PartialEq)]
 pub enum MethodLateContext {
@@ -142,6 +143,12 @@ fn check_item(&mut self, cx: &EarlyContext<'_>, it: &ast::Item) {
         }
     }
 
+    fn check_trait_item(&mut self, cx: &EarlyContext<'_>, it: &ast::AssocItem) {
+        if let ast::AssocItemKind::TyAlias(..) = it.kind {
+            self.check_case(cx, "associated type", &it.ident);
+        }
+    }
+
     fn check_variant(&mut self, cx: &EarlyContext<'_>, v: &ast::Variant) {
         self.check_case(cx, "variant", &v.ident);
     }
@@ -293,7 +300,7 @@ fn check_mod(
         }
     }
 
-    fn check_generic_param(&mut self, cx: &LateContext<'_, '_>, param: &hir::GenericParam) {
+    fn check_generic_param(&mut self, cx: &LateContext<'_, '_>, param: &hir::GenericParam<'_>) {
         if let GenericParamKind::Lifetime { .. } = param.kind {
             self.check_snake_case(cx, "lifetime", &param.name.ident());
         }
@@ -303,7 +310,7 @@ fn check_fn(
         &mut self,
         cx: &LateContext<'_, '_>,
         fk: FnKind<'_>,
-        _: &hir::FnDecl,
+        _: &hir::FnDecl<'_>,
         _: &hir::Body<'_>,
         _: Span,
         id: hir::HirId,
@@ -336,7 +343,7 @@ fn check_item(&mut self, cx: &LateContext<'_, '_>, it: &hir::Item<'_>) {
     }
 
     fn check_trait_item(&mut self, cx: &LateContext<'_, '_>, item: &hir::TraitItem<'_>) {
-        if let hir::TraitItemKind::Method(_, hir::TraitMethod::Required(pnames)) = &item.kind {
+        if let hir::TraitItemKind::Method(_, hir::TraitMethod::Required(pnames)) = item.kind {
             self.check_snake_case(cx, "trait method", &item.ident);
             for param_name in pnames {
                 self.check_snake_case(cx, "variable", param_name);
@@ -425,7 +432,7 @@ fn check_pat(&mut self, cx: &LateContext<'_, '_>, p: &hir::Pat<'_>) {
         }
     }
 
-    fn check_generic_param(&mut self, cx: &LateContext<'_, '_>, param: &hir::GenericParam) {
+    fn check_generic_param(&mut self, cx: &LateContext<'_, '_>, param: &hir::GenericParam<'_>) {
         if let GenericParamKind::Const { .. } = param.kind {
             NonUpperCaseGlobals::check_upper_case(cx, "const parameter", &param.name.ident());
         }