@@ -164,7 +164,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
164164 pub ( super ) fn lower_mod ( & mut self , m : & Mod ) -> hir:: Mod < ' hir > {
165165 hir:: Mod {
166166 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+ ) ,
168170 }
169171 }
170172
@@ -560,7 +562,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
560562 } ) ;
561563 }
562564
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) ;
564567 hir:: ItemKind :: Use ( path, hir:: UseKind :: Single )
565568 }
566569 UseTreeKind :: Glob => {
@@ -667,7 +670,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
667670
668671 let res = self . expect_full_res_from_use ( id) . next ( ) . unwrap_or ( Res :: Err ) ;
669672 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) ;
671675 hir:: ItemKind :: Use ( path, hir:: UseKind :: ListStem )
672676 }
673677 }
@@ -733,8 +737,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
733737 hir:: ForeignItemKind :: Fn ( fn_dec, fn_args, generics)
734738 }
735739 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)
738742 }
739743 ForeignItemKind :: Ty => hir:: ForeignItemKind :: Type ,
740744 ForeignItemKind :: Macro ( _) => panic ! ( "macro shouldn't exist here" ) ,
@@ -771,7 +775,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
771775 fn lower_variant_data ( & mut self , vdata : & VariantData ) -> hir:: VariantData < ' hir > {
772776 match * vdata {
773777 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+ ) ,
775781 recovered,
776782 ) ,
777783 VariantData :: Tuple ( ref fields, id) => {
@@ -823,15 +829,17 @@ impl<'hir> LoweringContext<'_, 'hir> {
823829 let trait_item_def_id = self . resolver . definitions ( ) . local_def_id ( i. id ) ;
824830
825831 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,
830838 default
831839 . as_ref ( )
832840 . map ( |x| self . lower_const_body ( i. span , Some ( x) ) ) ,
833- ) ,
834- ) ,
841+ ) )
842+ } ,
835843 AssocItemKind :: Fn ( ref sig, None ) => {
836844 let names = self . lower_fn_params_to_names ( & sig. decl ) ;
837845 let ( generics, sig) = self . lower_method_sig (
@@ -913,13 +921,15 @@ impl<'hir> LoweringContext<'_, 'hir> {
913921 let impl_item_def_id = self . resolver . definitions ( ) . local_def_id ( i. id ) ;
914922
915923 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,
920930 self . lower_const_body ( i. span , expr. as_deref ( ) ) ,
921- ) ,
922- ) ,
931+ ) )
932+ } ,
923933 AssocItemKind :: Fn ( ref sig, ref body) => {
924934 self . current_item = Some ( i. span ) ;
925935 let body_id = self . lower_maybe_async_body (
@@ -1302,7 +1312,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
13021312 this. expr_block ( P ( body) , AttrVec :: new ( ) )
13031313 } ) ;
13041314
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+ )
13061319 } )
13071320 }
13081321
0 commit comments