@@ -328,18 +328,18 @@ struct TypeParameter {
328328/// avoiding the insertion of any unnecessary blocks.
329329///
330330/// The statements come before the expression.
331- pub struct BlockOrExpr ( Vec < ast:: Stmt > , Option < P < Expr > > ) ;
331+ pub struct BlockOrExpr ( ThinVec < ast:: Stmt > , Option < P < Expr > > ) ;
332332
333333impl BlockOrExpr {
334- pub fn new_stmts ( stmts : Vec < ast:: Stmt > ) -> BlockOrExpr {
334+ pub fn new_stmts ( stmts : ThinVec < ast:: Stmt > ) -> BlockOrExpr {
335335 BlockOrExpr ( stmts, None )
336336 }
337337
338338 pub fn new_expr ( expr : P < Expr > ) -> BlockOrExpr {
339- BlockOrExpr ( vec ! [ ] , Some ( expr) )
339+ BlockOrExpr ( ThinVec :: new ( ) , Some ( expr) )
340340 }
341341
342- pub fn new_mixed ( stmts : Vec < ast:: Stmt > , expr : Option < P < Expr > > ) -> BlockOrExpr {
342+ pub fn new_mixed ( stmts : ThinVec < ast:: Stmt > , expr : Option < P < Expr > > ) -> BlockOrExpr {
343343 BlockOrExpr ( stmts, expr)
344344 }
345345
@@ -355,7 +355,7 @@ impl BlockOrExpr {
355355 fn into_expr ( self , cx : & ExtCtxt < ' _ > , span : Span ) -> P < Expr > {
356356 if self . 0 . is_empty ( ) {
357357 match self . 1 {
358- None => cx. expr_block ( cx. block ( span, vec ! [ ] ) ) ,
358+ None => cx. expr_block ( cx. block ( span, ThinVec :: new ( ) ) ) ,
359359 Some ( expr) => expr,
360360 }
361361 } else if self . 0 . len ( ) == 1
@@ -1146,7 +1146,7 @@ impl<'a> MethodDef<'a> {
11461146 // There is no sensible code to be generated for *any* deriving on a
11471147 // zero-variant enum. So we just generate a failing expression.
11481148 if variants. is_empty ( ) {
1149- return BlockOrExpr ( vec ! [ ] , Some ( deriving:: call_unreachable ( cx, span) ) ) ;
1149+ return BlockOrExpr ( ThinVec :: new ( ) , Some ( deriving:: call_unreachable ( cx, span) ) ) ;
11501150 }
11511151
11521152 let prefixes = iter:: once ( "__self" . to_string ( ) )
@@ -1182,7 +1182,7 @@ impl<'a> MethodDef<'a> {
11821182 let other_selflike_exprs = tag_exprs;
11831183 let tag_field = FieldInfo { span, name : None , self_expr, other_selflike_exprs } ;
11841184
1185- let tag_let_stmts: Vec < _ > = iter:: zip ( & tag_idents, & selflike_args)
1185+ let tag_let_stmts: ThinVec < _ > = iter:: zip ( & tag_idents, & selflike_args)
11861186 . map ( |( & ident, selflike_arg) | {
11871187 let variant_value = deriving:: call_intrinsic (
11881188 cx,
@@ -1362,7 +1362,7 @@ impl<'a> MethodDef<'a> {
13621362 tag_let_stmts. append ( & mut tag_check_plus_match. 0 ) ;
13631363 BlockOrExpr ( tag_let_stmts, tag_check_plus_match. 1 )
13641364 } else {
1365- BlockOrExpr ( vec ! [ ] , Some ( get_match_expr ( selflike_args) ) )
1365+ BlockOrExpr ( ThinVec :: new ( ) , Some ( get_match_expr ( selflike_args) ) )
13661366 }
13671367 }
13681368
@@ -1599,7 +1599,7 @@ impl<'a> TraitDef<'a> {
15991599 } else {
16001600 // Wrap the expression in `{...}`, causing a copy.
16011601 field_expr = cx. expr_block (
1602- cx. block ( struct_field. span , vec ! [ cx. stmt_expr( field_expr) ] ) ,
1602+ cx. block ( struct_field. span , thin_vec ! [ cx. stmt_expr( field_expr) ] ) ,
16031603 ) ;
16041604 }
16051605 }
0 commit comments