From 919889a1d688a6bbe2edac8705f048f06b1b455c Mon Sep 17 00:00:00 2001 From: Richo Healey Date: Tue, 15 Apr 2014 18:17:48 -0700 Subject: Replace all ~"" with "".to_owned() --- src/libsyntax/ext/asm.rs | 2 +- src/libsyntax/ext/deriving/encodable.rs | 6 +++--- src/libsyntax/ext/deriving/generic.rs | 2 +- src/libsyntax/ext/expand.rs | 26 +++++++++++++------------- src/libsyntax/ext/quote.rs | 32 ++++++++++++++++---------------- src/libsyntax/ext/tt/macro_parser.rs | 8 ++++---- src/libsyntax/ext/tt/macro_rules.rs | 2 +- 7 files changed, 39 insertions(+), 39 deletions(-) (limited to 'src/libsyntax/ext') diff --git a/src/libsyntax/ext/asm.rs b/src/libsyntax/ext/asm.rs index efefe885acb..9b362f8d942 100644 --- a/src/libsyntax/ext/asm.rs +++ b/src/libsyntax/ext/asm.rs @@ -56,7 +56,7 @@ pub fn expand_asm(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) let mut asm_str_style = None; let mut outputs = Vec::new(); let mut inputs = Vec::new(); - let mut cons = ~""; + let mut cons = "".to_owned(); let mut volatile = false; let mut alignstack = false; let mut dialect = ast::AsmAtt; diff --git a/src/libsyntax/ext/deriving/encodable.rs b/src/libsyntax/ext/deriving/encodable.rs index 90ea8701562..1c3edce96fb 100644 --- a/src/libsyntax/ext/deriving/encodable.rs +++ b/src/libsyntax/ext/deriving/encodable.rs @@ -36,7 +36,7 @@ impl Decodable for node_id { fn decode(d: &D) -> Node { d.read_struct("Node", 1, || { Node { - id: d.read_field(~"x", 0, || decode(d)) + id: d.read_field("x".to_owned(), 0, || decode(d)) } }) } @@ -73,8 +73,8 @@ would yield functions like: fn decode(d: &D) -> spanned { d.read_rec(|| { { - node: d.read_field(~"node", 0, || decode(d)), - span: d.read_field(~"span", 1, || decode(d)), + node: d.read_field("node".to_owned(), 0, || decode(d)), + span: d.read_field("span".to_owned(), 1, || decode(d)), } }) } diff --git a/src/libsyntax/ext/deriving/generic.rs b/src/libsyntax/ext/deriving/generic.rs index 8a44caf34a5..1d4aa08f9e3 100644 --- a/src/libsyntax/ext/deriving/generic.rs +++ b/src/libsyntax/ext/deriving/generic.rs @@ -864,7 +864,7 @@ impl<'a> MethodDef<'a> { } else { // there are still matches to create let current_match_str = if match_count == 0 { - ~"__self" + "__self".to_owned() } else { format!("__arg_{}", match_count) }; diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index d73cb3856f9..734d07ccb8f 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -1019,11 +1019,11 @@ mod test { // make sure that macros can leave scope #[should_fail] #[test] fn macros_cant_escape_fns_test () { - let src = ~"fn bogus() {macro_rules! z (() => (3+4))}\ - fn inty() -> int { z!() }"; + let src = "fn bogus() {macro_rules! z (() => (3+4))}\ + fn inty() -> int { z!() }".to_owned(); let sess = parse::new_parse_sess(); let crate_ast = parse::parse_crate_from_source_str( - ~"", + "".to_owned(), src, Vec::new(), &sess); // should fail: @@ -1039,11 +1039,11 @@ mod test { // make sure that macros can leave scope for modules #[should_fail] #[test] fn macros_cant_escape_mods_test () { - let src = ~"mod foo {macro_rules! z (() => (3+4))}\ - fn inty() -> int { z!() }"; + let src = "mod foo {macro_rules! z (() => (3+4))}\ + fn inty() -> int { z!() }".to_owned(); let sess = parse::new_parse_sess(); let crate_ast = parse::parse_crate_from_source_str( - ~"", + "".to_owned(), src, Vec::new(), &sess); // should fail: @@ -1058,11 +1058,11 @@ mod test { // macro_escape modules shouldn't cause macros to leave scope #[test] fn macros_can_escape_flattened_mods_test () { - let src = ~"#[macro_escape] mod foo {macro_rules! z (() => (3+4))}\ - fn inty() -> int { z!() }"; + let src = "#[macro_escape] mod foo {macro_rules! z (() => (3+4))}\ + fn inty() -> int { z!() }".to_owned(); let sess = parse::new_parse_sess(); let crate_ast = parse::parse_crate_from_source_str( - ~"", + "".to_owned(), src, Vec::new(), &sess); // should fail: @@ -1130,7 +1130,7 @@ mod test { //} #[test] fn macro_tokens_should_match(){ - expand_crate_str(~"macro_rules! m((a)=>(13)) fn main(){m!(a);}"); + expand_crate_str("macro_rules! m((a)=>(13)) fn main(){m!(a);}".to_owned()); } // renaming tests expand a crate and then check that the bindings match @@ -1260,10 +1260,10 @@ mod test { } #[test] fn fmt_in_macro_used_inside_module_macro() { - let crate_str = ~"macro_rules! fmt_wrap(($b:expr)=>($b.to_str())) + let crate_str = "macro_rules! fmt_wrap(($b:expr)=>($b.to_str())) macro_rules! foo_module (() => (mod generated { fn a() { let xx = 147; fmt_wrap!(xx);}})) foo_module!() -"; +".to_owned(); let cr = expand_crate_str(crate_str); // find the xx binding let mut name_finder = new_name_finder(Vec::new()); @@ -1309,7 +1309,7 @@ foo_module!() #[test] fn pat_idents(){ - let pat = string_to_pat(~"(a,Foo{x:c @ (b,9),y:Bar(4,d)})"); + let pat = string_to_pat("(a,Foo{x:c @ (b,9),y:Bar(4,d)})".to_owned()); let mut pat_idents = new_name_finder(Vec::new()); pat_idents.visit_pat(pat, ()); assert_eq!(pat_idents.ident_accumulator, diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index 7664d089149..7d86b988077 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -393,11 +393,11 @@ fn mk_token(cx: &ExtCtxt, sp: Span, tok: &token::Token) -> @ast::Expr { LIT_INT(i, ity) => { let s_ity = match ity { - ast::TyI => ~"TyI", - ast::TyI8 => ~"TyI8", - ast::TyI16 => ~"TyI16", - ast::TyI32 => ~"TyI32", - ast::TyI64 => ~"TyI64" + ast::TyI => "TyI".to_owned(), + ast::TyI8 => "TyI8".to_owned(), + ast::TyI16 => "TyI16".to_owned(), + ast::TyI32 => "TyI32".to_owned(), + ast::TyI64 => "TyI64".to_owned() }; let e_ity = cx.expr_ident(sp, id_ext(s_ity)); @@ -410,11 +410,11 @@ fn mk_token(cx: &ExtCtxt, sp: Span, tok: &token::Token) -> @ast::Expr { LIT_UINT(u, uty) => { let s_uty = match uty { - ast::TyU => ~"TyU", - ast::TyU8 => ~"TyU8", - ast::TyU16 => ~"TyU16", - ast::TyU32 => ~"TyU32", - ast::TyU64 => ~"TyU64" + ast::TyU => "TyU".to_owned(), + ast::TyU8 => "TyU8".to_owned(), + ast::TyU16 => "TyU16".to_owned(), + ast::TyU32 => "TyU32".to_owned(), + ast::TyU64 => "TyU64".to_owned() }; let e_uty = cx.expr_ident(sp, id_ext(s_uty)); @@ -435,8 +435,8 @@ fn mk_token(cx: &ExtCtxt, sp: Span, tok: &token::Token) -> @ast::Expr { LIT_FLOAT(fident, fty) => { let s_fty = match fty { - ast::TyF32 => ~"TyF32", - ast::TyF64 => ~"TyF64" + ast::TyF32 => "TyF32".to_owned(), + ast::TyF64 => "TyF64".to_owned() }; let e_fty = cx.expr_ident(sp, id_ext(s_fty)); @@ -649,10 +649,10 @@ fn expand_wrapper(cx: &ExtCtxt, cx_expr: @ast::Expr, expr: @ast::Expr) -> @ast::Expr { let uses = vec!( cx.view_use_glob(sp, ast::Inherited, - ids_ext(vec!(~"syntax", - ~"ext", - ~"quote", - ~"rt"))) ); + ids_ext(vec!("syntax".to_owned(), + "ext".to_owned(), + "quote".to_owned(), + "rt".to_owned()))) ); let stmt_let_ext_cx = cx.stmt_let(sp, false, id_ext("ext_cx"), cx_expr); diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index 62999fb496a..8143f2aceeb 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -366,9 +366,9 @@ pub fn parse(sess: &ParseSess, } return Success(nameize(sess, ms, v.as_slice())); } else if eof_eis.len() > 1u { - return Error(sp, ~"ambiguity: multiple successful parses"); + return Error(sp, "ambiguity: multiple successful parses".to_owned()); } else { - return Failure(sp, ~"unexpected end of macro invocation"); + return Failure(sp, "unexpected end of macro invocation".to_owned()); } } else { if (bb_eis.len() > 0u && next_eis.len() > 0u) @@ -436,7 +436,7 @@ pub fn parse_nt(p: &mut Parser, name: &str) -> Nonterminal { token::IDENT(sn,b) => { p.bump(); token::NtIdent(~sn,b) } _ => { let token_str = token::to_str(&p.token); - p.fatal(~"expected ident, found " + token_str) + p.fatal("expected ident, found ".to_owned() + token_str) } }, "path" => { @@ -450,6 +450,6 @@ pub fn parse_nt(p: &mut Parser, name: &str) -> Nonterminal { res } "matchers" => token::NtMatchers(p.parse_matchers()), - _ => p.fatal(~"unsupported builtin nonterminal parser: " + name) + _ => p.fatal("unsupported builtin nonterminal parser: ".to_owned() + name) } } diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index 279544d106e..78ea37587f0 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -132,7 +132,7 @@ fn generic_extension(cx: &ExtCtxt, // Which arm's failure should we report? (the one furthest along) let mut best_fail_spot = DUMMY_SP; - let mut best_fail_msg = ~"internal error: ran no matchers"; + let mut best_fail_msg = "internal error: ran no matchers".to_owned(); for (i, lhs) in lhses.iter().enumerate() { // try each arm's matchers match **lhs { -- cgit 1.4.1-3-g733a5