diff --git a/src/compiletest/errors.rs b/src/compiletest/errors.rs index c96e688c2900cae3d864b04715d2ef9df5cd5b7d..8e79f58c60881d21399b2c98f0ab750f98222a73 100644 --- a/src/compiletest/errors.rs +++ b/src/compiletest/errors.rs @@ -31,7 +31,7 @@ pub fn load_errors(re: &Regex, testfile: &Path) -> Vec { fn parse_expected(line_num: uint, line: &str, re: &Regex) -> Option { re.captures(line).and_then(|caps| { let adjusts = caps.name("adjusts").len(); - let kind = caps.name("kind").to_ascii().to_lower().into_str().to_string(); + let kind = caps.name("kind").to_ascii().to_lower().into_str(); let msg = caps.name("msg").trim().to_string(); debug!("line={} kind={} msg={}", line_num, kind, msg); diff --git a/src/compiletest/util.rs b/src/compiletest/util.rs index 00f0689b96b660b01295edafec35d65af743d929..84bf0eb11553e3a5be977aada46ec7ff9a433240 100644 --- a/src/compiletest/util.rs +++ b/src/compiletest/util.rs @@ -41,7 +41,7 @@ pub fn make_new_path(path: &str) -> String { Some(curr) => { format!("{}{}{}", path, path_div(), curr) } - None => path.to_str().to_string() + None => path.to_str() } } diff --git a/src/doc/complement-cheatsheet.md b/src/doc/complement-cheatsheet.md index 5ad0e82658d1a7c7eb7b1a4468e3603cd6b16cef..9797284a65b7d6e58ad40700a438be000a030db3 100644 --- a/src/doc/complement-cheatsheet.md +++ b/src/doc/complement-cheatsheet.md @@ -8,7 +8,7 @@ Use [`ToStr`](std/to_str/trait.ToStr.html). ~~~ let x: int = 42; -let y: String = x.to_str().to_string(); +let y: String = x.to_str(); ~~~ **String to int** diff --git a/src/doc/guide-tasks.md b/src/doc/guide-tasks.md index 6b45174591462776f7cf027c5376316fb8eab2f8..957b1d6ccc671d8c93ae80bd09609c381afc9cf2 100644 --- a/src/doc/guide-tasks.md +++ b/src/doc/guide-tasks.md @@ -467,7 +467,7 @@ fn stringifier(channel: &sync::DuplexStream) { let mut value: uint; loop { value = channel.recv(); - channel.send(value.to_str().to_string()); + channel.send(value.to_str()); if value == 0 { break; } } } @@ -492,7 +492,7 @@ extern crate sync; # let mut value: uint; # loop { # value = channel.recv(); -# channel.send(value.to_str().to_string()); +# channel.send(value.to_str()); # if value == 0u { break; } # } # } diff --git a/src/doc/rust.md b/src/doc/rust.md index b690c2eb983474635ccc9565b417576f06e09fd5..abd5de4d10c93ef3852160cc679ae8bfe02e3b7d 100644 --- a/src/doc/rust.md +++ b/src/doc/rust.md @@ -3579,7 +3579,7 @@ trait Printable { } impl Printable for int { - fn to_string(&self) -> String { self.to_str().to_string() } + fn to_string(&self) -> String { self.to_str() } } fn print(a: Box) { diff --git a/src/libgetopts/lib.rs b/src/libgetopts/lib.rs index 0311c3339241a5a2a9505126e2e5f7de3a2198ca..ddfe8380e09dd5c4a681f327db28f958c654a180 100644 --- a/src/libgetopts/lib.rs +++ b/src/libgetopts/lib.rs @@ -222,7 +222,7 @@ fn from_str(nm: &str) -> Name { fn to_str(&self) -> String { match *self { - Short(ch) => ch.to_str().to_string(), + Short(ch) => ch.to_str(), Long(ref s) => s.to_string() } } diff --git a/src/libnum/complex.rs b/src/libnum/complex.rs index 7febeb2661658571d0d46decd4a4b85e8241a29e..9ee80d283cf924621ac20309c075ea29d8fcf371 100644 --- a/src/libnum/complex.rs +++ b/src/libnum/complex.rs @@ -349,7 +349,7 @@ fn test_neg() { #[test] fn test_to_str() { fn test(c : Complex64, s: String) { - assert_eq!(c.to_str().to_string(), s); + assert_eq!(c.to_str(), s); } test(_0_0i, "0+0i".to_string()); test(_1_0i, "1+0i".to_string()); diff --git a/src/libnum/rational.rs b/src/libnum/rational.rs index 3efc359fd3fb343f600e851692b5fb96a92f9293..faf05365c04a0eef764cc89a20afdf3cc2663dda 100644 --- a/src/libnum/rational.rs +++ b/src/libnum/rational.rs @@ -559,7 +559,7 @@ fn test_recip() { fn test_to_from_str() { fn test(r: Rational, s: String) { assert_eq!(FromStr::from_str(s.as_slice()), Some(r)); - assert_eq!(r.to_str().to_string(), s); + assert_eq!(r.to_str(), s); } test(_1, "1/1".to_string()); test(_0, "0/1".to_string()); diff --git a/src/libregex_macros/lib.rs b/src/libregex_macros/lib.rs index ca64db3e2f75132d7b6d4b7998677cabd8d77109..fb7e4211d494c74e1d751cd7594fda9e11b22f91 100644 --- a/src/libregex_macros/lib.rs +++ b/src/libregex_macros/lib.rs @@ -620,7 +620,7 @@ fn parse(cx: &mut ExtCtxt, tts: &[ast::TokenTree]) -> Option { let regex = match entry.node { ast::ExprLit(lit) => { match lit.node { - ast::LitStr(ref s, _) => s.to_str().to_string(), + ast::LitStr(ref s, _) => s.to_str(), _ => { cx.span_err(entry.span, format!( "expected string literal but got `{}`", diff --git a/src/librustc/driver/driver.rs b/src/librustc/driver/driver.rs index d04df996186dde7c68086c6c60d352648755626e..89c0a381cf9f295afa4e38ab1b797eba50de5978 100644 --- a/src/librustc/driver/driver.rs +++ b/src/librustc/driver/driver.rs @@ -533,7 +533,7 @@ fn post(&self, match node { pprust::NodeItem(item) => { try!(pp::space(&mut s.s)); - s.synth_comment(item.id.to_str().to_string()) + s.synth_comment(item.id.to_str()) } pprust::NodeBlock(blk) => { try!(pp::space(&mut s.s)); @@ -541,7 +541,7 @@ fn post(&self, } pprust::NodeExpr(expr) => { try!(pp::space(&mut s.s)); - try!(s.synth_comment(expr.id.to_str().to_string())); + try!(s.synth_comment(expr.id.to_str())); s.pclose() } pprust::NodePat(pat) => { diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index ce02243403ff2ea4306e1d182da1345d5c5e4c52..b5cb0f8e5aac8b12b47e4d7075695ffcd4790f94 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -324,7 +324,7 @@ fn variable(&self, node_id: NodeId, span: Span) -> Variable { fn variable_name(&self, var: Variable) -> String { match self.var_kinds.get(var.get()) { &Local(LocalInfo { ident: nm, .. }) | &Arg(_, nm) => { - token::get_ident(nm).get().to_str().to_string() + token::get_ident(nm).get().to_str() }, &ImplicitRet => "".to_string() } diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index e6b48f024833452ddfc87be1df10a9ae0cd02ded..1d2ed72f70ea0283f8c53c5430571279985f0c3d 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -1303,7 +1303,7 @@ impl Repr for InteriorKind { fn repr(&self, _tcx: &ty::ctxt) -> String { match *self { InteriorField(NamedField(fld)) => { - token::get_name(fld).get().to_str().to_string() + token::get_name(fld).get().to_str() } InteriorField(PositionalField(i)) => format!("\\#{:?}", i), InteriorElement(_) => "[]".to_string(), diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs index 464e8cff0fa67b9b5a80dcb3d7421bf4101789db..6096060f975e9eab53456b797f3e5d4ceec3cc17 100644 --- a/src/librustc/middle/trans/base.rs +++ b/src/librustc/middle/trans/base.rs @@ -1927,7 +1927,7 @@ fn exported_name(ccx: &CrateContext, id: ast::NodeId, _ => ccx.tcx.map.with_path(id, |mut path| { if attr::contains_name(attrs, "no_mangle") { // Don't mangle - path.last().unwrap().to_str().to_string() + path.last().unwrap().to_str() } else { match weak_lang_items::link_name(attrs) { Some(name) => name.get().to_string(), diff --git a/src/librustc/middle/typeck/infer/to_str.rs b/src/librustc/middle/typeck/infer/to_str.rs index f03ecd9aee158322f0c81d1332a8383851fd4f1f..59d73c7fb1f2d917c94e03055688aea29d08385c 100644 --- a/src/librustc/middle/typeck/infer/to_str.rs +++ b/src/librustc/middle/typeck/infer/to_str.rs @@ -79,13 +79,13 @@ fn inf_str(&self, cx: &InferCtxt) -> String { impl InferStr for IntVarValue { fn inf_str(&self, _cx: &InferCtxt) -> String { - self.to_str().to_string() + self.to_str() } } impl InferStr for ast::FloatTy { fn inf_str(&self, _cx: &InferCtxt) -> String { - self.to_str().to_string() + self.to_str() } } diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index f73666bebf6d7c3ec58cc4c025f608b29f3c8e34..e14fd89fc74d72ce6bc7a1bd3dd4fdc9b424fbcb 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -366,7 +366,7 @@ fn push_sig_to_str(cx: &ctxt, ty_bare_fn(ref f) => { bare_fn_to_str(cx, f.fn_style, f.abi, None, &f.sig) } - ty_infer(infer_ty) => infer_ty.to_str().to_string(), + ty_infer(infer_ty) => infer_ty.to_str(), ty_err => "[type error]".to_string(), ty_param(param_ty {idx: id, def_id: did}) => { let ident = match cx.ty_param_defs.borrow().find(&did.node) { @@ -753,7 +753,10 @@ fn repr(&self, tcx: &ctxt) -> String { impl Repr for ty::Variance { fn repr(&self, _: &ctxt) -> String { - self.to_str().to_string() + // The first `.to_str()` returns a &'static str (it is not an implementation + // of the ToStr trait). Because of that, we need to call `.to_str()` again + // if we want to have a `String`. + self.to_str().to_str() } } @@ -950,13 +953,13 @@ fn user_string(&self, _tcx: &ctxt) -> String { impl Repr for abi::Abi { fn repr(&self, _tcx: &ctxt) -> String { - self.to_str().to_string() + self.to_str() } } impl UserString for abi::Abi { fn user_string(&self, _tcx: &ctxt) -> String { - self.to_str().to_string() + self.to_str() } } diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index 1bc6cfdabd32396f1f0feb7e9c85505cf30dc1ee..9d8bfa8302c74504198d9d2bd280c05cdc158b8f 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -93,7 +93,7 @@ fn try_inline_def(cx: &core::DocContext, cx.inlined.borrow_mut().get_mut_ref().insert(did); ret.push(clean::Item { source: clean::Span::empty(), - name: Some(fqn.last().unwrap().to_str().to_string()), + name: Some(fqn.last().unwrap().to_str()), attrs: load_attrs(tcx, did), inner: inner, visibility: Some(ast::Public), diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 1992c102e474e5f748a47942adbaedc85c9e1f6d..4614d7cee3a600504076e3b352bc9fa28181e187 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -526,7 +526,7 @@ fn clean(&self) -> TyParamBound { external_path("Share", &empty)), }; let fqn = csearch::get_item_path(tcx, did); - let fqn = fqn.move_iter().map(|i| i.to_str().to_string()).collect(); + let fqn = fqn.move_iter().map(|i| i.to_str()).collect(); cx.external_paths.borrow_mut().get_mut_ref().insert(did, (fqn, TypeTrait)); TraitBound(ResolvedPath { @@ -545,7 +545,7 @@ fn clean(&self) -> TyParamBound { core::NotTyped(_) => return RegionBound, }; let fqn = csearch::get_item_path(tcx, self.def_id); - let fqn = fqn.move_iter().map(|i| i.to_str().to_string()) + let fqn = fqn.move_iter().map(|i| i.to_str()) .collect::>(); let path = external_path(fqn.last().unwrap().as_slice(), &self.substs); @@ -1239,7 +1239,7 @@ fn clean(&self) -> Type { }; let fqn = csearch::get_item_path(tcx, did); let fqn: Vec = fqn.move_iter().map(|i| { - i.to_str().to_string() + i.to_str() }).collect(); let kind = match ty::get(*self).sty { ty::ty_struct(..) => TypeStruct, @@ -1617,7 +1617,7 @@ fn clean(&self) -> BareFunctionDecl { type_params: Vec::new(), }, decl: self.decl.clean(), - abi: self.abi.to_str().to_string(), + abi: self.abi.to_str(), } } } @@ -1891,12 +1891,12 @@ fn lit_to_str(lit: &ast::Lit) -> String { ast::LitStr(ref st, _) => st.get().to_string(), ast::LitBinary(ref data) => format!("{:?}", data.as_slice()), ast::LitChar(c) => format!("'{}'", c), - ast::LitInt(i, _t) => i.to_str().to_string(), - ast::LitUint(u, _t) => u.to_str().to_string(), - ast::LitIntUnsuffixed(i) => i.to_str().to_string(), + ast::LitInt(i, _t) => i.to_str(), + ast::LitUint(u, _t) => u.to_str(), + ast::LitIntUnsuffixed(i) => i.to_str(), ast::LitFloat(ref f, _t) => f.get().to_string(), ast::LitFloatUnsuffixed(ref f) => f.get().to_string(), - ast::LitBool(b) => b.to_str().to_string(), + ast::LitBool(b) => b.to_str(), ast::LitNil => "".to_string(), } } diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 41d84deea6f4105661c96cdf66cfb742ef8064a7..51d2a67d6cbf410f9148a1ca8d074254aa4590d6 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -401,7 +401,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { } else { let mut m = decl.bounds .iter() - .map(|s| s.to_str().to_string()); + .map(|s| s.to_str()); format!( ": {}", m.collect::>().connect(" + ")) diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index 373c5220161bd2b42db9aa5afccdeb05a1bd60a4..d1e2b5dffddd457819c02efbd08b9bf6b7f64c53 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -208,7 +208,7 @@ pub fn render(w: &mut fmt::Formatter, s: &str, print_toc: bool) -> fmt::Result { // Transform the contents of the header into a hyphenated string let id = (s.as_slice().words().map(|s| { match s.to_ascii_opt() { - Some(s) => s.to_lower().into_str().to_string(), + Some(s) => s.to_lower().into_str(), None => s.to_string() } }).collect::>().connect("-")).to_string(); diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index b3a0ade0624f395383ea439c396367275710a154..28443fc453f836ae2cbc8a8d4d60220d41aa04c3 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -359,7 +359,7 @@ fn json_input(input: &str) -> Result { } }; match json::from_reader(&mut input) { - Err(s) => Err(s.to_str().to_string()), + Err(s) => Err(s.to_str()), Ok(json::Object(obj)) => { let mut obj = obj; // Make sure the schema is what we expect diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs index d2e689b5934f050881fd1462a5f0027ed6d71b5a..93b66ede2671f3a87d895c2d976c96c93f44f3c7 100644 --- a/src/libsyntax/ext/source_util.rs +++ b/src/libsyntax/ext/source_util.rs @@ -125,7 +125,7 @@ pub fn expand_include_str(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) Some(src) => { // Add this input file to the code map to make it available as // dependency information - let filename = file.display().to_str().to_string(); + let filename = file.display().to_str(); let interned = token::intern_and_get_ident(src); cx.codemap().new_filemap(filename, src.to_string()); diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index 0622bf76ab92529966dd2a8dfcc309ab6ed55d64..c78d4d258f6f5ef317363c3844f5b3b71c69f962 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -252,7 +252,7 @@ fn ms(m: Matcher_) -> Matcher { box MacroRulesDefiner { def: RefCell::new(Some(MacroDef { - name: token::get_ident(name).to_str().to_string(), + name: token::get_ident(name).to_str(), ext: NormalTT(exp, Some(sp)) })) } as Box diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 42319eeb371d6f66751979de099826282797786e..129ea5fdf6d0406d8e98dd6a8bf4c54f90d174ec 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -205,7 +205,7 @@ pub fn to_str(t: &Token) -> String { ast_util::ForceSuffix), LIT_UINT(u, t) => ast_util::uint_ty_to_str(t, Some(u), ast_util::ForceSuffix), - LIT_INT_UNSUFFIXED(i) => { (i as u64).to_str().to_string() } + LIT_INT_UNSUFFIXED(i) => { (i as u64).to_str() } LIT_FLOAT(s, t) => { let mut body = String::from_str(get_ident(s).get()); if body.as_slice().ends_with(".") { diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index eba80ba17837872693e8fe10d4db8e85e26870d8..9e562a08ff95e9a1ee893e1fba41804490711227 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -1502,7 +1502,7 @@ pub fn filter_for_ignored_option() { let filtered = filter_tests(&opts, tests); assert_eq!(filtered.len(), 1); - assert_eq!(filtered.get(0).desc.name.to_str().to_string(), + assert_eq!(filtered.get(0).desc.name.to_str(), "1".to_string()); assert!(filtered.get(0).desc.ignore == false); } @@ -1553,7 +1553,7 @@ fn testfn() { } "test::sort_tests".to_string()); for (a, b) in expected.iter().zip(filtered.iter()) { - assert!(*a == b.desc.name.to_str().to_string()); + assert!(*a == b.desc.name.to_str()); } } diff --git a/src/libtime/lib.rs b/src/libtime/lib.rs index a478aa931d444cd6d338b371f0f14d33463b2748..90af1da78a457d096655d5ff8e6ac30318c63d31 100644 --- a/src/libtime/lib.rs +++ b/src/libtime/lib.rs @@ -1020,7 +1020,7 @@ fn parse_type(ch: char, tm: &Tm) -> String { 'U' => format!("{:02d}", (tm.tm_yday - tm.tm_wday + 7) / 7), 'u' => { let i = tm.tm_wday as int; - (if i == 0 { 7 } else { i }).to_str().to_string() + (if i == 0 { 7 } else { i }).to_str() } 'V' => iso_week('V', tm), 'v' => { @@ -1033,8 +1033,8 @@ fn parse_type(ch: char, tm: &Tm) -> String { format!("{:02d}", (tm.tm_yday - (tm.tm_wday - 1 + 7) % 7 + 7) / 7) } - 'w' => (tm.tm_wday as int).to_str().to_string(), - 'Y' => (tm.tm_year as int + 1900).to_str().to_string(), + 'w' => (tm.tm_wday as int).to_str(), + 'Y' => (tm.tm_year as int + 1900).to_str(), 'y' => format!("{:02d}", (tm.tm_year as int + 1900) % 100), 'Z' => "".to_string(), // FIXME(pcwalton): Implement this. 'z' => { diff --git a/src/liburl/lib.rs b/src/liburl/lib.rs index 3511b554aea89e0af5fbab09407e78eca27a194d..12db15df311097e8f2f8ebefd1604e4be8bf5111 100644 --- a/src/liburl/lib.rs +++ b/src/liburl/lib.rs @@ -524,7 +524,7 @@ fn get_authority(rawurl: &str) -> Result<(Option, String, Option, String), String> { if !rawurl.starts_with("//") { // there is no authority. - return Ok((None, "".to_string(), None, rawurl.to_str().to_string())); + return Ok((None, "".to_string(), None, rawurl.to_str())); } enum State { diff --git a/src/test/bench/core-set.rs b/src/test/bench/core-set.rs index 4b63d5095e19ef350547345447957fe06805d12f..c3e877f80817658efea54fe3618ee6687b80d9e3 100644 --- a/src/test/bench/core-set.rs +++ b/src/test/bench/core-set.rs @@ -90,11 +90,11 @@ pub fn bench_str, let mut set = f(); timed(&mut self.sequential_strings, || { for i in range(0u, num_keys) { - set.insert(i.to_str().to_string()); + set.insert(i.to_str()); } for i in range(0u, num_keys) { - assert!(set.contains(&i.to_str().to_string())); + assert!(set.contains(&i.to_str())); } }) } @@ -103,7 +103,7 @@ pub fn bench_str, let mut set = f(); timed(&mut self.random_strings, || { for _ in range(0, num_keys) { - let s = rng.gen::().to_str().to_string(); + let s = rng.gen::().to_str(); set.insert(s); } }) @@ -112,11 +112,11 @@ pub fn bench_str, { let mut set = f(); for i in range(0u, num_keys) { - set.insert(i.to_str().to_string()); + set.insert(i.to_str()); } timed(&mut self.delete_strings, || { for i in range(0u, num_keys) { - assert!(set.remove(&i.to_str().to_string())); + assert!(set.remove(&i.to_str())); } }) } diff --git a/src/test/run-pass/monad.rs b/src/test/run-pass/monad.rs index 3ad5da317013fd05f7422798338c6d5bfd8da4a3..2b67ef09c59db5152d610b4ee9741dcba2488888 100644 --- a/src/test/run-pass/monad.rs +++ b/src/test/run-pass/monad.rs @@ -38,7 +38,7 @@ fn bind(&self, f: |&A| -> Option) -> Option { } fn transform(x: Option) -> Option { - x.bind(|n| Some(*n + 1) ).bind(|n| Some(n.to_str().to_string()) ) + x.bind(|n| Some(*n + 1) ).bind(|n| Some(n.to_str()) ) } pub fn main() { diff --git a/src/test/run-pass/static-impl.rs b/src/test/run-pass/static-impl.rs index 1545de93786eeea2a26977d95abe27c1750d02f3..f6c314b20dd14fab9a0f18dc13338dbd812d5f08 100644 --- a/src/test/run-pass/static-impl.rs +++ b/src/test/run-pass/static-impl.rs @@ -31,7 +31,7 @@ trait uint_utils { impl uint_utils for uint { fn str(&self) -> String { - self.to_str().to_string() + self.to_str() } fn multi(&self, f: |uint|) { let mut c = 0u; diff --git a/src/test/run-pass/trait-cast.rs b/src/test/run-pass/trait-cast.rs index 454cf4c8eda21294b382ddd8089c181e6391ba3a..45c70bc2d945e48f73b0fe30a0944480a6a1b887 100644 --- a/src/test/run-pass/trait-cast.rs +++ b/src/test/run-pass/trait-cast.rs @@ -36,7 +36,7 @@ fn to_str_(&self) -> String { impl to_str for int { fn to_str_(&self) -> String { - self.to_str().to_string() + self.to_str() } } diff --git a/src/test/run-pass/trait-to-str.rs b/src/test/run-pass/trait-to-str.rs index ea5e0a9ee910b7698e6c80ffbca72356d362aab6..cd7c5c6f8f7d48ae6e94950e43cfe4d3fbf8b8cd 100644 --- a/src/test/run-pass/trait-to-str.rs +++ b/src/test/run-pass/trait-to-str.rs @@ -15,7 +15,7 @@ trait to_str { } impl to_str for int { - fn to_string(&self) -> String { self.to_str().to_string() } + fn to_string(&self) -> String { self.to_str() } } impl to_str for Vec {