@@ -214,8 +214,7 @@ pub fn lower_ty(_lctx: &LoweringContext, t: &Ty) -> P<hir::Ty> {
214
214
TyVec ( ref ty) => hir:: TyVec ( lower_ty ( _lctx, ty) ) ,
215
215
TyPtr ( ref mt) => hir:: TyPtr ( lower_mt ( _lctx, mt) ) ,
216
216
TyRptr ( ref region, ref mt) => {
217
- hir:: TyRptr ( lower_opt_lifetime ( _lctx, region) ,
218
- lower_mt ( _lctx, mt) )
217
+ hir:: TyRptr ( lower_opt_lifetime ( _lctx, region) , lower_mt ( _lctx, mt) )
219
218
}
220
219
TyBareFn ( ref f) => {
221
220
hir:: TyBareFn ( P ( hir:: BareFnTy {
@@ -502,13 +501,17 @@ pub fn lower_struct_def(_lctx: &LoweringContext, sd: &VariantData) -> P<hir::Var
502
501
P ( match * sd {
503
502
VariantData :: Struct ( ref fields, id) => {
504
503
hir:: VariantData :: Struct ( fields. iter ( )
505
- . map ( |f| lower_struct_field ( _lctx, f) ) . collect ( ) , id)
504
+ . map ( |f| lower_struct_field ( _lctx, f) )
505
+ . collect ( ) ,
506
+ id)
506
507
}
507
508
VariantData :: Tuple ( ref fields, id) => {
508
509
hir:: VariantData :: Tuple ( fields. iter ( )
509
- . map ( |f| lower_struct_field ( _lctx, f) ) . collect ( ) , id)
510
+ . map ( |f| lower_struct_field ( _lctx, f) )
511
+ . collect ( ) ,
512
+ id)
510
513
}
511
- VariantData :: Unit ( id) => hir:: VariantData :: Unit ( id)
514
+ VariantData :: Unit ( id) => hir:: VariantData :: Unit ( id) ,
512
515
} )
513
516
}
514
517
@@ -676,8 +679,7 @@ pub fn lower_impl_item(_lctx: &LoweringContext, i: &ImplItem) -> P<hir::ImplItem
676
679
hir:: ConstImplItem ( lower_ty ( _lctx, ty) , lower_expr ( _lctx, expr) )
677
680
}
678
681
MethodImplItem ( ref sig, ref body) => {
679
- hir:: MethodImplItem ( lower_method_sig ( _lctx, sig) ,
680
- lower_block ( _lctx, body) )
682
+ hir:: MethodImplItem ( lower_method_sig ( _lctx, sig) , lower_block ( _lctx, body) )
681
683
}
682
684
TypeImplItem ( ref ty) => hir:: TypeImplItem ( lower_ty ( _lctx, ty) ) ,
683
685
MacImplItem ( ..) => panic ! ( "Shouldn't exist any more" ) ,
@@ -743,8 +745,7 @@ pub fn lower_foreign_item(_lctx: &LoweringContext, i: &ForeignItem) -> P<hir::Fo
743
745
attrs : i. attrs . clone ( ) ,
744
746
node : match i. node {
745
747
ForeignItemFn ( ref fdec, ref generics) => {
746
- hir:: ForeignItemFn ( lower_fn_decl ( _lctx, fdec) ,
747
- lower_generics ( _lctx, generics) )
748
+ hir:: ForeignItemFn ( lower_fn_decl ( _lctx, fdec) , lower_generics ( _lctx, generics) )
748
749
}
749
750
ForeignItemStatic ( ref t, m) => {
750
751
hir:: ForeignItemStatic ( lower_ty ( _lctx, t) , m)
@@ -855,8 +856,8 @@ pub fn lower_pat(_lctx: &LoweringContext, p: &Pat) -> P<hir::Pat> {
855
856
}
856
857
PatTup ( ref elts) => hir:: PatTup ( elts. iter ( ) . map ( |x| lower_pat ( _lctx, x) ) . collect ( ) ) ,
857
858
PatBox ( ref inner) => hir:: PatBox ( lower_pat ( _lctx, inner) ) ,
858
- PatRegion ( ref inner, mutbl) => hir :: PatRegion ( lower_pat ( _lctx , inner ) ,
859
- lower_mutability ( _lctx, mutbl) ) ,
859
+ PatRegion ( ref inner, mutbl) =>
860
+ hir :: PatRegion ( lower_pat ( _lctx , inner ) , lower_mutability ( _lctx, mutbl) ) ,
860
861
PatRange ( ref e1, ref e2) => {
861
862
hir:: PatRange ( lower_expr ( _lctx, e1) , lower_expr ( _lctx, e2) )
862
863
}
@@ -1021,11 +1022,12 @@ pub fn lower_expr(lctx: &LoweringContext, e: &Expr) -> P<hir::Expr> {
1021
1022
// InPlace::finalize(place)
1022
1023
// })
1023
1024
let expr = {
1024
- let call_move_val_init = hir:: StmtSemi ( make_call ( lctx,
1025
- & move_val_init,
1026
- vec ! [ expr_ident( lctx, e. span, p_ptr_ident) ,
1027
- pop_unsafe_expr] ) ,
1028
- lctx. next_id ( ) ) ;
1025
+ let call_move_val_init =
1026
+ hir:: StmtSemi ( make_call ( lctx,
1027
+ & move_val_init,
1028
+ vec ! [ expr_ident( lctx, e. span, p_ptr_ident) ,
1029
+ pop_unsafe_expr] ) ,
1030
+ lctx. next_id ( ) ) ;
1029
1031
let call_move_val_init = respan ( e. span , call_move_val_init) ;
1030
1032
1031
1033
let call = make_call ( lctx,
@@ -1100,14 +1102,10 @@ pub fn lower_expr(lctx: &LoweringContext, e: &Expr) -> P<hir::Expr> {
1100
1102
}
1101
1103
} ) ;
1102
1104
1103
- hir:: ExprIf ( lower_expr ( lctx, cond) ,
1104
- lower_block ( lctx, blk) ,
1105
- else_opt)
1105
+ hir:: ExprIf ( lower_expr ( lctx, cond) , lower_block ( lctx, blk) , else_opt)
1106
1106
}
1107
1107
ExprWhile ( ref cond, ref body, opt_ident) => {
1108
- hir:: ExprWhile ( lower_expr ( lctx, cond) ,
1109
- lower_block ( lctx, body) ,
1110
- opt_ident)
1108
+ hir:: ExprWhile ( lower_expr ( lctx, cond) , lower_block ( lctx, body) , opt_ident)
1111
1109
}
1112
1110
ExprLoop ( ref body, opt_ident) => {
1113
1111
hir:: ExprLoop ( lower_block ( lctx, body) , opt_ident)
@@ -1132,8 +1130,7 @@ pub fn lower_expr(lctx: &LoweringContext, e: &Expr) -> P<hir::Expr> {
1132
1130
lower_expr ( lctx, er) )
1133
1131
}
1134
1132
ExprField ( ref el, ident) => {
1135
- hir:: ExprField ( lower_expr ( lctx, el) ,
1136
- respan ( ident. span , ident. node . name ) )
1133
+ hir:: ExprField ( lower_expr ( lctx, el) , respan ( ident. span , ident. node . name ) )
1137
1134
}
1138
1135
ExprTupField ( ref el, ident) => {
1139
1136
hir:: ExprTupField ( lower_expr ( lctx, el) , ident)
@@ -1406,10 +1403,7 @@ pub fn lower_expr(lctx: &LoweringContext, e: &Expr) -> P<hir::Expr> {
1406
1403
path_global ( e. span , strs)
1407
1404
} ;
1408
1405
1409
- expr_call ( lctx,
1410
- e. span ,
1411
- expr_path ( lctx, into_iter_path) ,
1412
- vec ! [ head] )
1406
+ expr_call ( lctx, e. span , expr_path ( lctx, into_iter_path) , vec ! [ head] )
1413
1407
} ;
1414
1408
1415
1409
let match_expr = expr_match ( lctx,
@@ -1569,9 +1563,7 @@ fn expr_match(lctx: &LoweringContext,
1569
1563
arms : Vec < hir:: Arm > ,
1570
1564
source : hir:: MatchSource )
1571
1565
-> P < hir:: Expr > {
1572
- expr ( lctx,
1573
- span,
1574
- hir:: ExprMatch ( arg, arms, source) )
1566
+ expr ( lctx, span, hir:: ExprMatch ( arg, arms, source) )
1575
1567
}
1576
1568
1577
1569
fn expr_block ( lctx : & LoweringContext , b : P < hir:: Block > ) -> P < hir:: Expr > {
@@ -1772,9 +1764,7 @@ mod test {
1772
1764
1773
1765
impl MockAssigner {
1774
1766
fn new ( ) -> MockAssigner {
1775
- MockAssigner {
1776
- next_id : Cell :: new ( 0 ) ,
1777
- }
1767
+ MockAssigner { next_id : Cell :: new ( 0 ) }
1778
1768
}
1779
1769
}
1780
1770
@@ -1794,14 +1784,18 @@ mod test {
1794
1784
expn_id : codemap:: NO_EXPANSION ,
1795
1785
}
1796
1786
}
1797
- fn cfg ( & self ) -> ast:: CrateConfig { Vec :: new ( ) }
1787
+ fn cfg ( & self ) -> ast:: CrateConfig {
1788
+ Vec :: new ( )
1789
+ }
1798
1790
fn ident_of ( & self , st : & str ) -> ast:: Ident {
1799
1791
parse:: token:: str_to_ident ( st)
1800
1792
}
1801
1793
fn name_of ( & self , st : & str ) -> ast:: Name {
1802
1794
parse:: token:: intern ( st)
1803
1795
}
1804
- fn parse_sess ( & self ) -> & parse:: ParseSess { self }
1796
+ fn parse_sess ( & self ) -> & parse:: ParseSess {
1797
+ self
1798
+ }
1805
1799
}
1806
1800
1807
1801
impl NodeIdAssigner for MockAssigner {
@@ -1828,11 +1822,20 @@ mod test {
1828
1822
let cx = parse:: ParseSess :: new ( ) ;
1829
1823
let mut assigner = MockAssigner :: new ( ) ;
1830
1824
1831
- let ast_if_let = quote_expr ! ( & cx, if let Some ( foo) = baz { bar( foo) ; } ) ;
1825
+ let ast_if_let = quote_expr ! ( & cx,
1826
+ if let Some ( foo) = baz {
1827
+ bar( foo) ;
1828
+ } ) ;
1832
1829
let ast_if_let = assigner. fold_expr ( ast_if_let) ;
1833
- let ast_while_let = quote_expr ! ( & cx, while let Some ( foo) = baz { bar( foo) ; } ) ;
1830
+ let ast_while_let = quote_expr ! ( & cx,
1831
+ while let Some ( foo) = baz {
1832
+ bar( foo) ;
1833
+ } ) ;
1834
1834
let ast_while_let = assigner. fold_expr ( ast_while_let) ;
1835
- let ast_for = quote_expr ! ( & cx, for i in 0 ..10 { foo( i) ; } ) ;
1835
+ let ast_for = quote_expr ! ( & cx,
1836
+ for i in 0 ..10 {
1837
+ foo( i) ;
1838
+ } ) ;
1836
1839
let ast_for = assigner. fold_expr ( ast_for) ;
1837
1840
let ast_in = quote_expr ! ( & cx, in HEAP { foo( ) } ) ;
1838
1841
let ast_in = assigner. fold_expr ( ast_in) ;
0 commit comments