about summary refs log tree commit diff
path: root/src/libsyntax/ext/auto_encode.rs
diff options
context:
space:
mode:
authorErick Tryzelaar <erick.tryzelaar@gmail.com>2013-02-17 10:59:09 -0800
committerErick Tryzelaar <erick.tryzelaar@gmail.com>2013-02-19 10:02:51 -0800
commitbc62bd378251d6dd60f2999cd8c853a75a4e8d02 (patch)
tree7f27b1abaab38625605525514b542f38d5968a11 /src/libsyntax/ext/auto_encode.rs
parent59ba4fc1042bb83dc6899462649d70a0141ff8ca (diff)
downloadrust-bc62bd378251d6dd60f2999cd8c853a75a4e8d02.tar.gz
rust-bc62bd378251d6dd60f2999cd8c853a75a4e8d02.zip
libsyntax: make enum variants take refs
Diffstat (limited to 'src/libsyntax/ext/auto_encode.rs')
-rw-r--r--src/libsyntax/ext/auto_encode.rs34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/libsyntax/ext/auto_encode.rs b/src/libsyntax/ext/auto_encode.rs
index 9c0550c9875..2809d1dcc56 100644
--- a/src/libsyntax/ext/auto_encode.rs
+++ b/src/libsyntax/ext/auto_encode.rs
@@ -127,24 +127,24 @@ pub fn expand_auto_encode(
     do vec::flat_map(in_items) |item| {
         if item.attrs.any(is_auto_encode) {
             match item.node {
-                ast::item_struct(@ast::struct_def { fields, _}, tps) => {
+                ast::item_struct(ref struct_def, ref tps) => {
                     let ser_impl = mk_struct_ser_impl(
                         cx,
                         item.span,
                         item.ident,
-                        fields,
-                        tps
+                        struct_def.fields,
+                        *tps
                     );
 
                     ~[filter_attrs(*item), ser_impl]
                 },
-                ast::item_enum(ref enum_def, tps) => {
+                ast::item_enum(ref enum_def, ref tps) => {
                     let ser_impl = mk_enum_ser_impl(
                         cx,
                         item.span,
                         item.ident,
-                        (*enum_def),
-                        tps
+                        *enum_def,
+                        *tps
                     );
 
                     ~[filter_attrs(*item), ser_impl]
@@ -182,24 +182,24 @@ pub fn expand_auto_decode(
     do vec::flat_map(in_items) |item| {
         if item.attrs.any(is_auto_decode) {
             match item.node {
-                ast::item_struct(@ast::struct_def { fields, _}, tps) => {
+                ast::item_struct(ref struct_def, ref tps) => {
                     let deser_impl = mk_struct_deser_impl(
                         cx,
                         item.span,
                         item.ident,
-                        fields,
-                        tps
+                        struct_def.fields,
+                        *tps
                     );
 
                     ~[filter_attrs(*item), deser_impl]
                 },
-                ast::item_enum(ref enum_def, tps) => {
+                ast::item_enum(ref enum_def, ref tps) => {
                     let deser_impl = mk_enum_deser_impl(
                         cx,
                         item.span,
                         item.ident,
-                        (*enum_def),
-                        tps
+                        *enum_def,
+                        *tps
                     );
 
                     ~[filter_attrs(*item), deser_impl]
@@ -410,7 +410,7 @@ fn mk_impl(
     ident: ast::ident,
     ty_param: ast::ty_param,
     path: @ast::path,
-    tps: ~[ast::ty_param],
+    tps: &[ast::ty_param],
     f: fn(@ast::Ty) -> @ast::method
 ) -> @ast::item {
     // All the type parameters need to bound to the trait.
@@ -458,7 +458,7 @@ fn mk_ser_impl(
     cx: ext_ctxt,
     span: span,
     ident: ast::ident,
-    tps: ~[ast::ty_param],
+    tps: &[ast::ty_param],
     body: @ast::expr
 ) -> @ast::item {
     // Make a path to the std::serialize::Encodable typaram.
@@ -666,8 +666,8 @@ fn mk_struct_ser_impl(
     cx: ext_ctxt,
     span: span,
     ident: ast::ident,
-    fields: ~[@ast::struct_field],
-    tps: ~[ast::ty_param]
+    fields: &[@ast::struct_field],
+    tps: &[ast::ty_param]
 ) -> @ast::item {
     let fields = do mk_struct_fields(fields).mapi |idx, field| {
         // ast for `|| self.$(name).encode(__s)`
@@ -808,7 +808,7 @@ struct field {
     mutbl: ast::mutability,
 }
 
-fn mk_struct_fields(fields: ~[@ast::struct_field]) -> ~[field] {
+fn mk_struct_fields(fields: &[@ast::struct_field]) -> ~[field] {
     do fields.map |field| {
         let (ident, mutbl) = match field.node.kind {
             ast::named_field(ident, mutbl, _) => (ident, mutbl),