]> git.lizzy.rs Git - rust.git/blobdiff - src/libsyntax/ext/deriving/primitive.rs
libsyntax: Mechanically change `~[T]` to `Vec<T>`
[rust.git] / src / libsyntax / ext / deriving / primitive.rs
index 03192cc1cd2f20952052d1d8ced53aca925e8db2..2615479fa72aa498c8dc62d9bd9842132a0f622f 100644 (file)
@@ -23,21 +23,20 @@ pub fn expand_deriving_from_primitive(cx: &mut ExtCtxt,
                                       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,
@@ -48,19 +47,17 @@ pub fn expand_deriving_from_primitive(cx: &mut ExtCtxt,
                 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)
@@ -84,7 +81,7 @@ fn cs_from(name: &str, cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure
                 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 {
@@ -109,7 +106,7 @@ fn cs_from(name: &str, cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure
 
                         // 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),
                         };
@@ -128,7 +125,7 @@ fn cs_from(name: &str, cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure
 
             // 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)),
             };