push: |@Item|) {
let trait_def = TraitDef {
span: span,
- attributes: ~[],
- path: Path::new(~["std", "num", "FromPrimitive"]),
- additional_bounds: ~[],
+ attributes: Vec::new(),
+ path: Path::new(vec!("std", "num", "FromPrimitive")),
+ additional_bounds: Vec::new(),
generics: LifetimeBounds::empty(),
- methods: ~[
+ methods: vec!(
MethodDef {
name: "from_i64",
generics: LifetimeBounds::empty(),
explicit_self: None,
- args: ~[
- Literal(Path::new(~["i64"])),
- ],
- ret_ty: Literal(Path::new_(~["std", "option", "Option"],
+ args: vec!(
+ Literal(Path::new(vec!("i64")))),
+ ret_ty: Literal(Path::new_(vec!("std", "option", "Option"),
None,
- ~[~Self],
+ vec!(~Self),
true)),
// liable to cause code-bloat
inline: true,
name: "from_u64",
generics: LifetimeBounds::empty(),
explicit_self: None,
- args: ~[
- Literal(Path::new(~["u64"])),
- ],
- ret_ty: Literal(Path::new_(~["std", "option", "Option"],
+ args: vec!(
+ Literal(Path::new(vec!("u64")))),
+ ret_ty: Literal(Path::new_(vec!("std", "option", "Option"),
None,
- ~[~Self],
+ vec!(~Self),
true)),
// liable to cause code-bloat
inline: true,
const_nonmatching: false,
combine_substructure: |c, s, sub| cs_from("u64", c, s, sub),
- },
- ]
+ })
};
trait_def.expand(cx, mitem, item, push)
return cx.expr_fail(trait_span, InternedString::new(""));
}
- let mut arms = ~[];
+ let mut arms = Vec::new();
for variant in enum_def.variants.iter() {
match variant.node.kind {
// arm for `_ if $guard => $body`
let arm = ast::Arm {
- pats: ~[cx.pat_wild(span)],
+ pats: vec!(cx.pat_wild(span)),
guard: Some(guard),
body: cx.block_expr(body),
};
// arm for `_ => None`
let arm = ast::Arm {
- pats: ~[cx.pat_wild(trait_span)],
+ pats: vec!(cx.pat_wild(trait_span)),
guard: None,
body: cx.block_expr(cx.expr_none(trait_span)),
};