@@ -19,8 +19,8 @@ use hir_def::{
1919 data:: adt:: VariantData ,
2020 hir:: { Pat , PatId } ,
2121 src:: HasSource ,
22- AdtId , AttrDefId , ConstId , DefWithBodyId , EnumId , EnumVariantId , FunctionId , ItemContainerId ,
23- Lookup , ModuleDefId , ModuleId , StaticId , StructId ,
22+ AdtId , AttrDefId , ConstId , EnumId , FunctionId , ItemContainerId , Lookup , ModuleDefId , ModuleId ,
23+ StaticId , StructId ,
2424} ;
2525use hir_expand:: {
2626 name:: { AsName , Name } ,
@@ -290,8 +290,6 @@ impl<'a> DeclValidator<'a> {
290290 return ;
291291 }
292292
293- self . validate_body_inner_items ( func. into ( ) ) ;
294-
295293 // Check whether non-snake case identifiers are allowed for this function.
296294 if self . allowed ( func. into ( ) , allow:: NON_SNAKE_CASE , false ) {
297295 return ;
@@ -568,11 +566,6 @@ impl<'a> DeclValidator<'a> {
568566 fn validate_enum ( & mut self , enum_id : EnumId ) {
569567 let data = self . db . enum_data ( enum_id) ;
570568
571- for ( local_id, _) in data. variants . iter ( ) {
572- let variant_id = EnumVariantId { parent : enum_id, local_id } ;
573- self . validate_body_inner_items ( variant_id. into ( ) ) ;
574- }
575-
576569 // Check whether non-camel case names are allowed for this enum.
577570 if self . allowed ( enum_id. into ( ) , allow:: NON_CAMEL_CASE_TYPES , false ) {
578571 return ;
@@ -697,8 +690,6 @@ impl<'a> DeclValidator<'a> {
697690 fn validate_const ( & mut self , const_id : ConstId ) {
698691 let data = self . db . const_data ( const_id) ;
699692
700- self . validate_body_inner_items ( const_id. into ( ) ) ;
701-
702693 if self . allowed ( const_id. into ( ) , allow:: NON_UPPER_CASE_GLOBAL , false ) {
703694 return ;
704695 }
@@ -747,8 +738,6 @@ impl<'a> DeclValidator<'a> {
747738 return ;
748739 }
749740
750- self . validate_body_inner_items ( static_id. into ( ) ) ;
751-
752741 if self . allowed ( static_id. into ( ) , allow:: NON_UPPER_CASE_GLOBAL , false ) {
753742 return ;
754743 }
@@ -786,17 +775,4 @@ impl<'a> DeclValidator<'a> {
786775
787776 self . sink . push ( diagnostic) ;
788777 }
789-
790- // FIXME: We don't currently validate names within `DefWithBodyId::InTypeConstId`.
791- /// Recursively validates inner scope items, such as static variables and constants.
792- fn validate_body_inner_items ( & mut self , body_id : DefWithBodyId ) {
793- let body = self . db . body ( body_id) ;
794- for ( _, block_def_map) in body. blocks ( self . db . upcast ( ) ) {
795- for ( _, module) in block_def_map. modules ( ) {
796- for def_id in module. scope . declarations ( ) {
797- self . validate_item ( def_id) ;
798- }
799- }
800- }
801- }
802778}
0 commit comments