diff options
Diffstat (limited to 'src/libsyntax/ext/deriving')
| -rw-r--r-- | src/libsyntax/ext/deriving/cmp/ord.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/ext/deriving/cmp/totalord.rs | 16 | ||||
| -rw-r--r-- | src/libsyntax/ext/deriving/decodable.rs | 70 | ||||
| -rw-r--r-- | src/libsyntax/ext/deriving/encodable.rs | 60 | ||||
| -rw-r--r-- | src/libsyntax/ext/deriving/mod.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/ext/deriving/rand.rs | 12 | ||||
| -rw-r--r-- | src/libsyntax/ext/deriving/to_str.rs | 8 | ||||
| -rw-r--r-- | src/libsyntax/ext/deriving/ty.rs | 2 |
8 files changed, 90 insertions, 90 deletions
diff --git a/src/libsyntax/ext/deriving/cmp/ord.rs b/src/libsyntax/ext/deriving/cmp/ord.rs index 5998fc7145d..a9234c858f4 100644 --- a/src/libsyntax/ext/deriving/cmp/ord.rs +++ b/src/libsyntax/ext/deriving/cmp/ord.rs @@ -58,9 +58,9 @@ fn cs_ord(less: bool, equal: bool, cx: @ext_ctxt, span: span, substr: &Substructure) -> @expr { let binop = if less { - cx.ident_of(~"lt") + cx.ident_of("lt") } else { - cx.ident_of(~"gt") + cx.ident_of("gt") }; let false_blk_expr = build::mk_block(cx, span, ~[], ~[], @@ -101,7 +101,7 @@ fn cs_ord(less: bool, equal: bool, } let cmp = build::mk_method_call(cx, span, - self_f, cx.ident_of(~"eq"), other_fs.to_owned()); + self_f, cx.ident_of("eq"), other_fs.to_owned()); let subexpr = build::mk_simple_block(cx, span, subexpr); let elseif = expr_if(cmp, subexpr, Some(false_blk_expr)); let elseif = build::mk_expr(cx, span, elseif); diff --git a/src/libsyntax/ext/deriving/cmp/totalord.rs b/src/libsyntax/ext/deriving/cmp/totalord.rs index ac873c5bd12..7d560a197d0 100644 --- a/src/libsyntax/ext/deriving/cmp/totalord.rs +++ b/src/libsyntax/ext/deriving/cmp/totalord.rs @@ -43,21 +43,21 @@ pub fn expand_deriving_totalord(cx: @ext_ctxt, pub fn ordering_const(cx: @ext_ctxt, span: span, cnst: Ordering) -> @expr { let cnst = match cnst { - Less => ~"Less", - Equal => ~"Equal", - Greater => ~"Greater" + Less => "Less", + Equal => "Equal", + Greater => "Greater" }; build::mk_path_global(cx, span, - ~[cx.ident_of(~"core"), - cx.ident_of(~"cmp"), + ~[cx.ident_of("core"), + cx.ident_of("cmp"), cx.ident_of(cnst)]) } pub fn cs_cmp(cx: @ext_ctxt, span: span, substr: &Substructure) -> @expr { - let lexical_ord = ~[cx.ident_of(~"core"), - cx.ident_of(~"cmp"), - cx.ident_of(~"lexical_ordering")]; + let lexical_ord = ~[cx.ident_of("core"), + cx.ident_of("cmp"), + cx.ident_of("lexical_ordering")]; cs_same_method_fold( // foldr (possibly) nests the matches in lexical_ordering better diff --git a/src/libsyntax/ext/deriving/decodable.rs b/src/libsyntax/ext/deriving/decodable.rs index 2bdfe51c50e..fd5d26a1787 100644 --- a/src/libsyntax/ext/deriving/decodable.rs +++ b/src/libsyntax/ext/deriving/decodable.rs @@ -41,15 +41,15 @@ fn create_derived_decodable_impl( ) -> @item { let decoder_ty_param = build::mk_ty_param( cx, - cx.ident_of(~"__D"), + cx.ident_of("__D"), @opt_vec::with( build::mk_trait_ty_param_bound_global( cx, span, ~[ - cx.ident_of(~"std"), - cx.ident_of(~"serialize"), - cx.ident_of(~"Decoder"), + cx.ident_of("std"), + cx.ident_of("serialize"), + cx.ident_of("Decoder"), ] ) ) @@ -62,13 +62,13 @@ fn create_derived_decodable_impl( let trait_path = build::mk_raw_path_global_( span, ~[ - cx.ident_of(~"std"), - cx.ident_of(~"serialize"), - cx.ident_of(~"Decodable") + cx.ident_of("std"), + cx.ident_of("serialize"), + cx.ident_of("Decodable") ], None, ~[ - build::mk_simple_ty_path(cx, span, cx.ident_of(~"__D")) + build::mk_simple_ty_path(cx, span, cx.ident_of("__D")) ] ); create_derived_impl( @@ -96,11 +96,11 @@ fn create_decode_method( let d_arg_type = build::mk_ty_rptr( cx, span, - build::mk_simple_ty_path(cx, span, cx.ident_of(~"__D")), + build::mk_simple_ty_path(cx, span, cx.ident_of("__D")), None, ast::m_mutbl ); - let d_ident = cx.ident_of(~"__d"); + let d_ident = cx.ident_of("__d"); let d_arg = build::mk_arg(cx, span, d_ident, d_arg_type); // Create the type of the return value. @@ -120,7 +120,7 @@ fn create_decode_method( // Create the method. let self_ty = spanned { node: sty_static, span: span }; - let method_ident = cx.ident_of(~"decode"); + let method_ident = cx.ident_of("decode"); @ast::method { ident: method_ident, attrs: ~[], @@ -148,14 +148,14 @@ fn call_substructure_decode_method( cx, span, ~[ - cx.ident_of(~"std"), - cx.ident_of(~"serialize"), - cx.ident_of(~"Decodable"), - cx.ident_of(~"decode"), + cx.ident_of("std"), + cx.ident_of("serialize"), + cx.ident_of("Decodable"), + cx.ident_of("decode"), ] ), ~[ - build::mk_path(cx, span, ~[cx.ident_of(~"__d")]) + build::mk_path(cx, span, ~[cx.ident_of("__d")]) ] ) } @@ -223,14 +223,14 @@ fn create_read_struct_field( let d_arg = build::mk_arg(cx, span, - cx.ident_of(~"__d"), + cx.ident_of("__d"), build::mk_ty_infer(cx, span)); let call_expr = build::mk_method_call( cx, span, - build::mk_path(cx, span, ~[cx.ident_of(~"__d")]), - cx.ident_of(~"read_struct_field"), + build::mk_path(cx, span, ~[cx.ident_of("__d")]), + cx.ident_of("read_struct_field"), ~[ build::mk_base_str(cx, span, cx.str_of(ident)), build::mk_uint(cx, span, idx), @@ -257,8 +257,8 @@ fn create_read_struct_arg( let call_expr = build::mk_method_call( cx, span, - build::mk_path(cx, span, ~[cx.ident_of(~"__d")]), - cx.ident_of(~"read_struct_arg"), + build::mk_path(cx, span, ~[cx.ident_of("__d")]), + cx.ident_of("read_struct_arg"), ~[ build::mk_uint(cx, span, idx), build::mk_lambda_no_args(cx, span, decode_expr), @@ -295,7 +295,7 @@ fn expand_deriving_decodable_struct_method( let d_arg = build::mk_arg(cx, span, - cx.ident_of(~"__d"), + cx.ident_of("__d"), build::mk_ty_infer(cx, span)); let read_struct_expr = build::mk_method_call( @@ -304,9 +304,9 @@ fn expand_deriving_decodable_struct_method( build::mk_path( cx, span, - ~[cx.ident_of(~"__d")] + ~[cx.ident_of("__d")] ), - cx.ident_of(~"read_struct"), + cx.ident_of("read_struct"), ~[ build::mk_base_str(cx, span, cx.str_of(type_ident)), build::mk_uint(cx, span, fields.len()), @@ -353,15 +353,15 @@ fn create_read_variant_arg( let d_arg = build::mk_arg(cx, span, - cx.ident_of(~"__d"), + cx.ident_of("__d"), build::mk_ty_infer(cx, span)); let t_infer = build::mk_ty_infer(cx, span); let call_expr = build::mk_method_call( cx, span, - build::mk_path(cx, span, ~[cx.ident_of(~"__d")]), - cx.ident_of(~"read_enum_variant_arg"), + build::mk_path(cx, span, ~[cx.ident_of("__d")]), + cx.ident_of("read_enum_variant_arg"), ~[ build::mk_uint(cx, span, j), build::mk_lambda(cx, @@ -416,8 +416,8 @@ fn create_read_enum_variant( build::mk_method_call( cx, span, - build::mk_path(cx, span, ~[cx.ident_of(~"__d")]), - cx.ident_of(~"read_enum_variant"), + build::mk_path(cx, span, ~[cx.ident_of("__d")]), + cx.ident_of("read_enum_variant"), ~[ expr_arm_names, build::mk_lambda( @@ -428,13 +428,13 @@ fn create_read_enum_variant( build::mk_arg( cx, span, - cx.ident_of(~"__d"), + cx.ident_of("__d"), build::mk_ty_infer(cx, span) ), build::mk_arg( cx, span, - cx.ident_of(~"__i"), + cx.ident_of("__i"), build::mk_ty_infer(cx, span) ) ], @@ -444,7 +444,7 @@ fn create_read_enum_variant( cx, span, ast::expr_match( - build::mk_path(cx, span, ~[cx.ident_of(~"__i")]), + build::mk_path(cx, span, ~[cx.ident_of("__i")]), arms ) ) @@ -468,15 +468,15 @@ fn expand_deriving_decodable_enum_method( let d_arg = build::mk_arg(cx, span, - cx.ident_of(~"__d"), + cx.ident_of("__d"), build::mk_ty_infer(cx, span)); // Create the read_enum expression let read_enum_expr = build::mk_method_call( cx, span, - build::mk_path(cx, span, ~[cx.ident_of(~"__d")]), - cx.ident_of(~"read_enum"), + build::mk_path(cx, span, ~[cx.ident_of("__d")]), + cx.ident_of("read_enum"), ~[ build::mk_base_str(cx, span, cx.str_of(type_ident)), build::mk_lambda(cx, diff --git a/src/libsyntax/ext/deriving/encodable.rs b/src/libsyntax/ext/deriving/encodable.rs index 54e5687f415..2786c9c6eb5 100644 --- a/src/libsyntax/ext/deriving/encodable.rs +++ b/src/libsyntax/ext/deriving/encodable.rs @@ -41,15 +41,15 @@ fn create_derived_encodable_impl( ) -> @item { let encoder_ty_param = build::mk_ty_param( cx, - cx.ident_of(~"__E"), + cx.ident_of("__E"), @opt_vec::with( build::mk_trait_ty_param_bound_global( cx, span, ~[ - cx.ident_of(~"std"), - cx.ident_of(~"serialize"), - cx.ident_of(~"Encoder"), + cx.ident_of("std"), + cx.ident_of("serialize"), + cx.ident_of("Encoder"), ] ) ) @@ -62,13 +62,13 @@ fn create_derived_encodable_impl( let trait_path = build::mk_raw_path_global_( span, ~[ - cx.ident_of(~"std"), - cx.ident_of(~"serialize"), - cx.ident_of(~"Encodable") + cx.ident_of("std"), + cx.ident_of("serialize"), + cx.ident_of("Encodable") ], None, ~[ - build::mk_simple_ty_path(cx, span, cx.ident_of(~"__E")) + build::mk_simple_ty_path(cx, span, cx.ident_of("__E")) ] ); create_derived_impl( @@ -94,11 +94,11 @@ fn create_encode_method( let e_arg_type = build::mk_ty_rptr( cx, span, - build::mk_simple_ty_path(cx, span, cx.ident_of(~"__E")), + build::mk_simple_ty_path(cx, span, cx.ident_of("__E")), None, ast::m_mutbl ); - let e_arg = build::mk_arg(cx, span, cx.ident_of(~"__e"), e_arg_type); + let e_arg = build::mk_arg(cx, span, cx.ident_of("__e"), e_arg_type); // Create the type of the return value. let output_type = @ast::Ty { id: cx.next_id(), node: ty_nil, span: span }; @@ -112,7 +112,7 @@ fn create_encode_method( // Create the method. let self_ty = spanned { node: sty_region(None, m_imm), span: span }; - let method_ident = cx.ident_of(~"encode"); + let method_ident = cx.ident_of("encode"); @ast::method { ident: method_ident, attrs: ~[], @@ -134,11 +134,11 @@ fn call_substructure_encode_method( self_field: @expr ) -> @ast::expr { // Gather up the parameters we want to chain along. - let e_ident = cx.ident_of(~"__e"); + let e_ident = cx.ident_of("__e"); let e_expr = build::mk_path(cx, span, ~[e_ident]); // Call the substructure method. - let encode_ident = cx.ident_of(~"encode"); + let encode_ident = cx.ident_of("encode"); build::mk_method_call( cx, span, @@ -204,7 +204,7 @@ fn expand_deriving_encodable_struct_method( type_ident: ident, struct_def: &struct_def ) -> @method { - let self_ident = cx.ident_of(~"self"); + let self_ident = cx.ident_of("self"); // Create the body of the method. let mut idx = 0; @@ -227,7 +227,7 @@ fn expand_deriving_encodable_struct_method( self_field ); - let e_ident = cx.ident_of(~"__e"); + let e_ident = cx.ident_of("__e"); let e_arg = build::mk_arg(cx, span, e_ident, @@ -243,8 +243,8 @@ fn expand_deriving_encodable_struct_method( let call_expr = build::mk_method_call( cx, span, - build::mk_path(cx, span, ~[cx.ident_of(~"__e")]), - cx.ident_of(~"emit_struct_field"), + build::mk_path(cx, span, ~[cx.ident_of("__e")]), + cx.ident_of("emit_struct_field"), ~[ build::mk_base_str(cx, span, cx.str_of(ident)), build::mk_uint(cx, span, idx), @@ -266,7 +266,7 @@ fn expand_deriving_encodable_struct_method( let e_arg = build::mk_arg(cx, span, - cx.ident_of(~"__e"), + cx.ident_of("__e"), build::mk_ty_infer(cx, span)); let emit_struct_stmt = build::mk_method_call( @@ -275,9 +275,9 @@ fn expand_deriving_encodable_struct_method( build::mk_path( cx, span, - ~[cx.ident_of(~"__e")] + ~[cx.ident_of("__e")] ), - cx.ident_of(~"emit_struct"), + cx.ident_of("emit_struct"), ~[ build::mk_base_str(cx, span, cx.str_of(type_ident)), build::mk_uint(cx, span, statements.len()), @@ -305,7 +305,7 @@ fn expand_deriving_encodable_enum_method( // Create the arms of the match in the method body. let arms = do enum_definition.variants.mapi |i, variant| { // Create the matching pattern. - let (pat, fields) = create_enum_variant_pattern(cx, span, variant, ~"__self", ast::m_imm); + let (pat, fields) = create_enum_variant_pattern(cx, span, variant, "__self", ast::m_imm); // Feed the discriminant to the encode function. let mut stmts = ~[]; @@ -317,7 +317,7 @@ fn expand_deriving_encodable_enum_method( // Call the substructure method. let expr = call_substructure_encode_method(cx, span, field); - let e_ident = cx.ident_of(~"__e"); + let e_ident = cx.ident_of("__e"); let e_arg = build::mk_arg(cx, span, e_ident, @@ -333,8 +333,8 @@ fn expand_deriving_encodable_enum_method( let call_expr = build::mk_method_call( cx, span, - build::mk_path(cx, span, ~[cx.ident_of(~"__e")]), - cx.ident_of(~"emit_enum_variant_arg"), + build::mk_path(cx, span, ~[cx.ident_of("__e")]), + cx.ident_of("emit_enum_variant_arg"), ~[ build::mk_uint(cx, span, j), blk_expr, @@ -347,13 +347,13 @@ fn expand_deriving_encodable_enum_method( // Create the pattern body. let e_arg = build::mk_arg(cx, span, - cx.ident_of(~"__e"), + cx.ident_of("__e"), build::mk_ty_infer(cx, span)); let call_expr = build::mk_method_call( cx, span, - build::mk_path(cx, span, ~[cx.ident_of(~"__e")]), - cx.ident_of(~"emit_enum_variant"), + build::mk_path(cx, span, ~[cx.ident_of("__e")]), + cx.ident_of("emit_enum_variant"), ~[ build::mk_base_str(cx, span, cx.str_of(variant.node.name)), build::mk_uint(cx, span, i), @@ -377,7 +377,7 @@ fn expand_deriving_encodable_enum_method( } }; - let e_ident = cx.ident_of(~"__e"); + let e_ident = cx.ident_of("__e"); let e_arg = build::mk_arg(cx, span, e_ident, @@ -394,8 +394,8 @@ fn expand_deriving_encodable_enum_method( let call_expr = build::mk_method_call( cx, span, - build::mk_path(cx, span, ~[cx.ident_of(~"__e")]), - cx.ident_of(~"emit_enum"), + build::mk_path(cx, span, ~[cx.ident_of("__e")]), + cx.ident_of("emit_enum"), ~[ build::mk_base_str(cx, span, cx.str_of(type_ident)), lambda_expr, diff --git a/src/libsyntax/ext/deriving/mod.rs b/src/libsyntax/ext/deriving/mod.rs index 2bd45e1466c..78eacafe3d7 100644 --- a/src/libsyntax/ext/deriving/mod.rs +++ b/src/libsyntax/ext/deriving/mod.rs @@ -263,7 +263,7 @@ pub fn create_struct_pattern(cx: @ext_ctxt, span: span, struct_ident: ident, struct_def: &struct_def, - prefix: ~str, + prefix: &str, mutbl: ast::mutability) -> (@ast::pat, ~[(Option<ident>, @expr)]) { if struct_def.fields.is_empty() { @@ -323,7 +323,7 @@ pub fn create_struct_pattern(cx: @ext_ctxt, pub fn create_enum_variant_pattern(cx: @ext_ctxt, span: span, variant: &ast::variant, - prefix: ~str, + prefix: &str, mutbl: ast::mutability) -> (@ast::pat, ~[(Option<ident>, @expr)]) { @@ -371,7 +371,7 @@ pub fn expand_enum_or_struct_match(cx: @ext_ctxt, span: span, arms: ~[ ast::arm ]) -> @expr { - let self_ident = cx.ident_of(~"self"); + let self_ident = cx.ident_of("self"); let self_expr = build::mk_path(cx, span, ~[ self_ident ]); let self_expr = build::mk_unary(cx, span, ast::deref, self_expr); let self_match_expr = ast::expr_match(self_expr, arms); diff --git a/src/libsyntax/ext/deriving/rand.rs b/src/libsyntax/ext/deriving/rand.rs index 604686f442f..9030be86f39 100644 --- a/src/libsyntax/ext/deriving/rand.rs +++ b/src/libsyntax/ext/deriving/rand.rs @@ -53,10 +53,10 @@ fn rand_substructure(cx: @ext_ctxt, span: span, substr: &Substructure) -> @expr _ => cx.bug("Incorrect number of arguments to `rand` in `deriving(Rand)`") }; let rand_ident = ~[ - cx.ident_of(~"core"), - cx.ident_of(~"rand"), - cx.ident_of(~"Rand"), - cx.ident_of(~"rand") + cx.ident_of("core"), + cx.ident_of("rand"), + cx.ident_of("Rand"), + cx.ident_of("rand") ]; let rand_call = || { build::mk_call_global(cx, @@ -77,8 +77,8 @@ fn rand_substructure(cx: @ext_ctxt, span: span, substr: &Substructure) -> @expr let variant_count = build::mk_uint(cx, span, variants.len()); // need to specify the uint-ness of the random number - let u32_ty = build::mk_ty_path(cx, span, ~[cx.ident_of(~"uint")]); - let r_ty = build::mk_ty_path(cx, span, ~[cx.ident_of(~"R")]); + let u32_ty = build::mk_ty_path(cx, span, ~[cx.ident_of("uint")]); + let r_ty = build::mk_ty_path(cx, span, ~[cx.ident_of("R")]); let rand_name = build::mk_raw_path_(span, copy rand_ident, None, ~[ u32_ty, r_ty ]); let rand_name = build::mk_path_raw(cx, span, rand_name); diff --git a/src/libsyntax/ext/deriving/to_str.rs b/src/libsyntax/ext/deriving/to_str.rs index 2c7d449585f..6010354349e 100644 --- a/src/libsyntax/ext/deriving/to_str.rs +++ b/src/libsyntax/ext/deriving/to_str.rs @@ -44,11 +44,11 @@ fn to_str_substructure(cx: @ext_ctxt, span: span, substr: &Substructure) -> @exp [self_obj] => { let self_addr = build::mk_addr_of(cx, span, self_obj); build::mk_call_global(cx, span, - ~[cx.ident_of(~"core"), - cx.ident_of(~"sys"), - cx.ident_of(~"log_str")], + ~[cx.ident_of("core"), + cx.ident_of("sys"), + cx.ident_of("log_str")], ~[self_addr]) } _ => cx.span_bug(span, ~"Invalid number of arguments in `deriving(ToStr)`") } -} \ No newline at end of file +} diff --git a/src/libsyntax/ext/deriving/ty.rs b/src/libsyntax/ext/deriving/ty.rs index 6195a3a6424..08947efa7b7 100644 --- a/src/libsyntax/ext/deriving/ty.rs +++ b/src/libsyntax/ext/deriving/ty.rs @@ -218,7 +218,7 @@ pub impl LifetimeBounds { pub fn get_explicit_self(cx: @ext_ctxt, span: span, self_ptr: Option<PtrTy>) -> (@expr, ast::self_ty) { - let self_path = build::mk_path(cx, span, ~[cx.ident_of(~"self")]); + let self_path = build::mk_path(cx, span, ~[cx.ident_of("self")]); match self_ptr { None => { (self_path, respan(span, ast::sty_value)) |
