@@ -164,7 +164,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
164
164
pub ( super ) fn lower_mod ( & mut self , m : & Mod ) -> hir:: Mod < ' hir > {
165
165
hir:: Mod {
166
166
inner : m. inner ,
167
- item_ids : self . arena . alloc_from_iter ( m. items . iter ( ) . flat_map ( |x| self . lower_item_id ( x) ) ) ,
167
+ item_ids : self . arena . alloc_from_iter (
168
+ m. items . iter ( ) . flat_map ( |x| self . lower_item_id ( x) )
169
+ ) ,
168
170
}
169
171
}
170
172
@@ -560,7 +562,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
560
562
} ) ;
561
563
}
562
564
563
- let path = self . arena . alloc ( self . lower_path_extra ( ret_res, & path, ParamMode :: Explicit , None ) ) ;
565
+ let path = self . lower_path_extra ( ret_res, & path, ParamMode :: Explicit , None ) ;
566
+ let path = self . arena . alloc ( path) ;
564
567
hir:: ItemKind :: Use ( path, hir:: UseKind :: Single )
565
568
}
566
569
UseTreeKind :: Glob => {
@@ -667,7 +670,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
667
670
668
671
let res = self . expect_full_res_from_use ( id) . next ( ) . unwrap_or ( Res :: Err ) ;
669
672
let res = self . lower_res ( res) ;
670
- let path = self . arena . alloc ( self . lower_path_extra ( res, & prefix, ParamMode :: Explicit , None ) ) ;
673
+ let path = self . lower_path_extra ( res, & prefix, ParamMode :: Explicit , None ) ;
674
+ let path = self . arena . alloc ( path) ;
671
675
hir:: ItemKind :: Use ( path, hir:: UseKind :: ListStem )
672
676
}
673
677
}
@@ -733,8 +737,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
733
737
hir:: ForeignItemKind :: Fn ( fn_dec, fn_args, generics)
734
738
}
735
739
ForeignItemKind :: Static ( ref t, m) => {
736
- hir :: ForeignItemKind :: Static (
737
- self . arena . alloc ( self . lower_ty ( t , ImplTraitContext :: disallowed ( ) ) . into_inner ( ) ) , m)
740
+ let ty = self . lower_ty ( t , ImplTraitContext :: disallowed ( ) ) ;
741
+ hir :: ForeignItemKind :: Static ( self . arena . alloc ( ty . into_inner ( ) ) , m)
738
742
}
739
743
ForeignItemKind :: Ty => hir:: ForeignItemKind :: Type ,
740
744
ForeignItemKind :: Macro ( _) => panic ! ( "macro shouldn't exist here" ) ,
@@ -771,7 +775,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
771
775
fn lower_variant_data ( & mut self , vdata : & VariantData ) -> hir:: VariantData < ' hir > {
772
776
match * vdata {
773
777
VariantData :: Struct ( ref fields, recovered) => hir:: VariantData :: Struct (
774
- self . arena . alloc_from_iter ( fields. iter ( ) . enumerate ( ) . map ( |f| self . lower_struct_field ( f) ) ) ,
778
+ self . arena . alloc_from_iter (
779
+ fields. iter ( ) . enumerate ( ) . map ( |f| self . lower_struct_field ( f) )
780
+ ) ,
775
781
recovered,
776
782
) ,
777
783
VariantData :: Tuple ( ref fields, id) => {
@@ -823,15 +829,17 @@ impl<'hir> LoweringContext<'_, 'hir> {
823
829
let trait_item_def_id = self . resolver . definitions ( ) . local_def_id ( i. id ) ;
824
830
825
831
let ( generics, kind) = match i. kind {
826
- AssocItemKind :: Const ( ref ty, ref default) => (
827
- self . lower_generics ( & i. generics , ImplTraitContext :: disallowed ( ) ) ,
828
- hir:: TraitItemKind :: Const (
829
- self . arena . alloc ( self . lower_ty ( ty, ImplTraitContext :: disallowed ( ) ) . into_inner ( ) ) ,
832
+ AssocItemKind :: Const ( ref ty, ref default) => {
833
+ let generics = self . lower_generics ( & i. generics , ImplTraitContext :: disallowed ( ) ) ;
834
+ let ty = self . lower_ty ( ty, ImplTraitContext :: disallowed ( ) ) ;
835
+ let ty = self . arena . alloc ( ty. into_inner ( ) ) ;
836
+ ( generics, hir:: TraitItemKind :: Const (
837
+ ty,
830
838
default
831
839
. as_ref ( )
832
840
. map ( |x| self . lower_const_body ( i. span , Some ( x) ) ) ,
833
- ) ,
834
- ) ,
841
+ ) )
842
+ } ,
835
843
AssocItemKind :: Fn ( ref sig, None ) => {
836
844
let names = self . lower_fn_params_to_names ( & sig. decl ) ;
837
845
let ( generics, sig) = self . lower_method_sig (
@@ -913,13 +921,15 @@ impl<'hir> LoweringContext<'_, 'hir> {
913
921
let impl_item_def_id = self . resolver . definitions ( ) . local_def_id ( i. id ) ;
914
922
915
923
let ( generics, kind) = match i. kind {
916
- AssocItemKind :: Const ( ref ty, ref expr) => (
917
- self . lower_generics ( & i. generics , ImplTraitContext :: disallowed ( ) ) ,
918
- hir:: ImplItemKind :: Const (
919
- self . arena . alloc ( self . lower_ty ( ty, ImplTraitContext :: disallowed ( ) ) . into_inner ( ) ) ,
924
+ AssocItemKind :: Const ( ref ty, ref expr) => {
925
+ let generics = self . lower_generics ( & i. generics , ImplTraitContext :: disallowed ( ) ) ;
926
+ let ty = self . lower_ty ( ty, ImplTraitContext :: disallowed ( ) ) ;
927
+ let ty = self . arena . alloc ( ty. into_inner ( ) ) ;
928
+ ( generics, hir:: ImplItemKind :: Const (
929
+ ty,
920
930
self . lower_const_body ( i. span , expr. as_deref ( ) ) ,
921
- ) ,
922
- ) ,
931
+ ) )
932
+ } ,
923
933
AssocItemKind :: Fn ( ref sig, ref body) => {
924
934
self . current_item = Some ( i. span ) ;
925
935
let body_id = self . lower_maybe_async_body (
@@ -1302,7 +1312,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
1302
1312
this. expr_block ( P ( body) , AttrVec :: new ( ) )
1303
1313
} ) ;
1304
1314
1305
- ( this. arena . alloc_from_iter ( parameters) , this. expr ( body_span, async_expr, AttrVec :: new ( ) ) )
1315
+ (
1316
+ this. arena . alloc_from_iter ( parameters) ,
1317
+ this. expr ( body_span, async_expr, AttrVec :: new ( ) ) ,
1318
+ )
1306
1319
} )
1307
1320
}
1308
1321
0 commit comments