@@ -328,18 +328,18 @@ struct TypeParameter {
328
328
/// avoiding the insertion of any unnecessary blocks.
329
329
///
330
330
/// 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 > > ) ;
332
332
333
333
impl BlockOrExpr {
334
- pub fn new_stmts ( stmts : Vec < ast:: Stmt > ) -> BlockOrExpr {
334
+ pub fn new_stmts ( stmts : ThinVec < ast:: Stmt > ) -> BlockOrExpr {
335
335
BlockOrExpr ( stmts, None )
336
336
}
337
337
338
338
pub fn new_expr ( expr : P < Expr > ) -> BlockOrExpr {
339
- BlockOrExpr ( vec ! [ ] , Some ( expr) )
339
+ BlockOrExpr ( ThinVec :: new ( ) , Some ( expr) )
340
340
}
341
341
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 {
343
343
BlockOrExpr ( stmts, expr)
344
344
}
345
345
@@ -355,7 +355,7 @@ impl BlockOrExpr {
355
355
fn into_expr ( self , cx : & ExtCtxt < ' _ > , span : Span ) -> P < Expr > {
356
356
if self . 0 . is_empty ( ) {
357
357
match self . 1 {
358
- None => cx. expr_block ( cx. block ( span, vec ! [ ] ) ) ,
358
+ None => cx. expr_block ( cx. block ( span, ThinVec :: new ( ) ) ) ,
359
359
Some ( expr) => expr,
360
360
}
361
361
} else if self . 0 . len ( ) == 1
@@ -1146,7 +1146,7 @@ impl<'a> MethodDef<'a> {
1146
1146
// There is no sensible code to be generated for *any* deriving on a
1147
1147
// zero-variant enum. So we just generate a failing expression.
1148
1148
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) ) ) ;
1150
1150
}
1151
1151
1152
1152
let prefixes = iter:: once ( "__self" . to_string ( ) )
@@ -1182,7 +1182,7 @@ impl<'a> MethodDef<'a> {
1182
1182
let other_selflike_exprs = tag_exprs;
1183
1183
let tag_field = FieldInfo { span, name : None , self_expr, other_selflike_exprs } ;
1184
1184
1185
- let tag_let_stmts: Vec < _ > = iter:: zip ( & tag_idents, & selflike_args)
1185
+ let tag_let_stmts: ThinVec < _ > = iter:: zip ( & tag_idents, & selflike_args)
1186
1186
. map ( |( & ident, selflike_arg) | {
1187
1187
let variant_value = deriving:: call_intrinsic (
1188
1188
cx,
@@ -1362,7 +1362,7 @@ impl<'a> MethodDef<'a> {
1362
1362
tag_let_stmts. append ( & mut tag_check_plus_match. 0 ) ;
1363
1363
BlockOrExpr ( tag_let_stmts, tag_check_plus_match. 1 )
1364
1364
} else {
1365
- BlockOrExpr ( vec ! [ ] , Some ( get_match_expr ( selflike_args) ) )
1365
+ BlockOrExpr ( ThinVec :: new ( ) , Some ( get_match_expr ( selflike_args) ) )
1366
1366
}
1367
1367
}
1368
1368
@@ -1599,7 +1599,7 @@ impl<'a> TraitDef<'a> {
1599
1599
} else {
1600
1600
// Wrap the expression in `{...}`, causing a copy.
1601
1601
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) ] ) ,
1603
1603
) ;
1604
1604
}
1605
1605
}
0 commit comments