@@ -19,8 +19,8 @@ use hir_def::{
19
19
data:: adt:: VariantData ,
20
20
hir:: { Pat , PatId } ,
21
21
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 ,
24
24
} ;
25
25
use hir_expand:: {
26
26
name:: { AsName , Name } ,
@@ -290,8 +290,6 @@ impl<'a> DeclValidator<'a> {
290
290
return ;
291
291
}
292
292
293
- self . validate_body_inner_items ( func. into ( ) ) ;
294
-
295
293
// Check whether non-snake case identifiers are allowed for this function.
296
294
if self . allowed ( func. into ( ) , allow:: NON_SNAKE_CASE , false ) {
297
295
return ;
@@ -568,11 +566,6 @@ impl<'a> DeclValidator<'a> {
568
566
fn validate_enum ( & mut self , enum_id : EnumId ) {
569
567
let data = self . db . enum_data ( enum_id) ;
570
568
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
-
576
569
// Check whether non-camel case names are allowed for this enum.
577
570
if self . allowed ( enum_id. into ( ) , allow:: NON_CAMEL_CASE_TYPES , false ) {
578
571
return ;
@@ -697,8 +690,6 @@ impl<'a> DeclValidator<'a> {
697
690
fn validate_const ( & mut self , const_id : ConstId ) {
698
691
let data = self . db . const_data ( const_id) ;
699
692
700
- self . validate_body_inner_items ( const_id. into ( ) ) ;
701
-
702
693
if self . allowed ( const_id. into ( ) , allow:: NON_UPPER_CASE_GLOBAL , false ) {
703
694
return ;
704
695
}
@@ -747,8 +738,6 @@ impl<'a> DeclValidator<'a> {
747
738
return ;
748
739
}
749
740
750
- self . validate_body_inner_items ( static_id. into ( ) ) ;
751
-
752
741
if self . allowed ( static_id. into ( ) , allow:: NON_UPPER_CASE_GLOBAL , false ) {
753
742
return ;
754
743
}
@@ -786,17 +775,4 @@ impl<'a> DeclValidator<'a> {
786
775
787
776
self . sink . push ( diagnostic) ;
788
777
}
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
- }
802
778
}
0 commit comments