diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs index c9e44a79160..16190f69549 100644 --- a/src/compiletest/runtest.rs +++ b/src/compiletest/runtest.rs @@ -244,7 +244,7 @@ fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) { None => copy *config }; let config = &mut config; - let cmds = str::connect(props.debugger_cmds, "\n"); + let cmds = props.debugger_cmds.connect("\n"); let check_lines = copy props.check_lines; // compile test file (it shoud have 'compile-flags:-g' in the header) @@ -645,13 +645,13 @@ fn program_output(config: &config, testfile: &Path, lib_path: &str, prog: ~str, #[cfg(target_os = "macos")] #[cfg(target_os = "freebsd")] fn make_cmdline(_libpath: &str, prog: &str, args: &[~str]) -> ~str { - fmt!("%s %s", prog, str::connect(args, " ")) + fmt!("%s %s", prog, args.connect(" ")) } #[cfg(target_os = "win32")] fn make_cmdline(libpath: &str, prog: &str, args: &[~str]) -> ~str { fmt!("%s %s %s", lib_path_cmd_prefix(libpath), prog, - str::connect(args, " ")) + args.connect(" ")) } // Build the LD_LIBRARY_PATH variable as it would be seen on the command line diff --git a/src/libextra/getopts.rs b/src/libextra/getopts.rs index 76e921f02f9..44b56590083 100644 --- a/src/libextra/getopts.rs +++ b/src/libextra/getopts.rs @@ -648,14 +648,14 @@ pub mod groups { // FIXME: #5516 // wrapped description - row += str::connect(desc_rows, desc_sep); + row += desc_rows.connect(desc_sep); row }); return str::to_owned(brief) + "\n\nOptions:\n" + - str::connect(rows, "\n") + + rows.connect("\n") + "\n\n"; } } // end groups module diff --git a/src/libextra/net_url.rs b/src/libextra/net_url.rs index 30d55721efb..46e76a7a399 100644 --- a/src/libextra/net_url.rs +++ b/src/libextra/net_url.rs @@ -354,7 +354,7 @@ pub fn query_to_str(query: &Query) -> ~str { } } } - return str::connect(strvec, "&"); + return strvec.connect("&"); } // returns the scheme and the rest of the url, or a parsing error diff --git a/src/libextra/num/bigint.rs b/src/libextra/num/bigint.rs index 0294b595cfd..c6e7592a314 100644 --- a/src/libextra/num/bigint.rs +++ b/src/libextra/num/bigint.rs @@ -520,10 +520,10 @@ impl ToStrRadix for BigUint { fn fill_concat(v: &[BigDigit], radix: uint, l: uint) -> ~str { if v.is_empty() { return ~"0" } - let s = str::concat(vec::reversed(v).map(|n| { + let s = vec::reversed(v).map(|n| { let s = uint::to_str_radix(*n as uint, radix); str::from_chars(vec::from_elem(l - s.len(), '0')) + s - })); + }).concat(); s.trim_left_chars(['0']).to_owned() } } diff --git a/src/libextra/semver.rs b/src/libextra/semver.rs index dad08075238..c7d2010e609 100644 --- a/src/libextra/semver.rs +++ b/src/libextra/semver.rs @@ -81,12 +81,12 @@ impl ToStr for Version { let s = if self.pre.is_empty() { s } else { - s + "-" + str::connect(self.pre.map(|i| i.to_str()), ".") + s + "-" + self.pre.map(|i| i.to_str()).connect(".") }; if self.build.is_empty() { s } else { - s + "+" + str::connect(self.build.map(|i| i.to_str()), ".") + s + "+" + self.build.map(|i| i.to_str()).connect(".") } } } diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs index fa9e2c9a724..496c1f88a6c 100644 --- a/src/librustc/back/link.rs +++ b/src/librustc/back/link.rs @@ -394,7 +394,7 @@ pub mod write { sess.err(fmt!("building with `%s` failed with code %d", cc_prog, prog.status)); sess.note(fmt!("%s arguments: %s", - cc_prog, str::connect(cc_args, " "))); + cc_prog, cc_args.connect(" "))); sess.note(str::from_bytes(prog.error + prog.output)); sess.abort_if_errors(); } @@ -809,14 +809,14 @@ pub fn link_binary(sess: Session, debug!("output: %s", output.to_str()); let cc_args = link_args(sess, obj_filename, out_filename, lm); - debug!("%s link args: %s", cc_prog, str::connect(cc_args, " ")); + debug!("%s link args: %s", cc_prog, cc_args.connect(" ")); // We run 'cc' here let prog = run::process_output(cc_prog, cc_args); if 0 != prog.status { sess.err(fmt!("linking with `%s` failed with code %d", cc_prog, prog.status)); sess.note(fmt!("%s arguments: %s", - cc_prog, str::connect(cc_args, " "))); + cc_prog, cc_args.connect(" "))); sess.note(str::from_bytes(prog.error + prog.output)); sess.abort_if_errors(); } diff --git a/src/librustc/driver/driver.rs b/src/librustc/driver/driver.rs index 5af47880c30..ef5670da455 100644 --- a/src/librustc/driver/driver.rs +++ b/src/librustc/driver/driver.rs @@ -328,8 +328,8 @@ pub fn compile_rest(sess: Session, let outputs = outputs.get_ref(); if (sess.opts.debugging_opts & session::print_link_args) != 0 { - io::println(str::connect(link::link_args(sess, - &outputs.obj_filename, &outputs.out_filename, link_meta), " ")); + io::println(link::link_args(sess, &outputs.obj_filename, + &outputs.out_filename, link_meta).connect(" ")); } // NB: Android hack diff --git a/src/librustc/middle/trans/asm.rs b/src/librustc/middle/trans/asm.rs index ac92ea75963..833146a935e 100644 --- a/src/librustc/middle/trans/asm.rs +++ b/src/librustc/middle/trans/asm.rs @@ -87,7 +87,7 @@ pub fn trans_inline_asm(bcx: block, ia: &ast::inline_asm) -> block { revoke_clean(bcx, *c); } - let mut constraints = str::connect(constraints, ","); + let mut constraints = constraints.connect(","); let mut clobbers = getClobbers(); if *ia.clobbers != ~"" && clobbers != ~"" { diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs index f368255030b..b913a1b4996 100644 --- a/src/librustc/middle/trans/base.rs +++ b/src/librustc/middle/trans/base.rs @@ -1995,7 +1995,7 @@ pub fn trans_enum_variant(ccx: @CrateContext, debug!("trans_enum_variant: name=%s tps=%s repr=%? enum_ty=%s", unsafe { str::raw::from_c_str(llvm::LLVMGetValueName(llfndecl)) }, - ~"[" + str::connect(ty_param_substs.map(|&t| ty_to_str(ccx.tcx, t)), ", ") + "]", + ~"[" + ty_param_substs.map(|&t| ty_to_str(ccx.tcx.connect(t)), ", ") + "]", repr, ty_to_str(ccx.tcx, enum_ty)); adt::trans_start_init(bcx, repr, fcx.llretptr.get(), disr); diff --git a/src/librustc/middle/trans/build.rs b/src/librustc/middle/trans/build.rs index 3b26a2cbf22..8406444bd09 100644 --- a/src/librustc/middle/trans/build.rs +++ b/src/librustc/middle/trans/build.rs @@ -192,7 +192,7 @@ pub fn Invoke(cx: block, terminate(cx, "Invoke"); debug!("Invoke(%s with arguments (%s))", val_str(cx.ccx().tn, Fn), - str::connect(vec::map(Args, |a| val_str(cx.ccx().tn, + vec::map(Args.connect(|a| val_str(cx.ccx().tn, *a).to_owned()), ", ")); unsafe { diff --git a/src/librustc/middle/trans/common.rs b/src/librustc/middle/trans/common.rs index a3491114bd3..b29972f039b 100644 --- a/src/librustc/middle/trans/common.rs +++ b/src/librustc/middle/trans/common.rs @@ -1483,7 +1483,7 @@ pub fn node_id_type_params(bcx: block, id: ast::node_id) -> ~[ty::t] { if !params.all(|t| !ty::type_needs_infer(*t)) { bcx.sess().bug( fmt!("Type parameters for node %d include inference types: %s", - id, str::connect(params.map(|t| bcx.ty_to_str(*t)), ","))); + id, params.map(|t| bcx.ty_to_str(*t)).connect(","))); } match bcx.fcx.param_substs { diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs index 9eb5f815954..30dd677396b 100644 --- a/src/librustc/middle/typeck/check/mod.rs +++ b/src/librustc/middle/typeck/check/mod.rs @@ -1879,7 +1879,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, } else { "s" }, - str::connect(missing_fields, ", "))); + missing_fields.connect(", "))); } } diff --git a/src/librustc/middle/typeck/infer/test.rs b/src/librustc/middle/typeck/infer/test.rs index e6e6753255e..0db9d16adf3 100644 --- a/src/librustc/middle/typeck/infer/test.rs +++ b/src/librustc/middle/typeck/infer/test.rs @@ -100,7 +100,7 @@ impl Env { return match search_mod(self, &self.crate.node.module, 0, names) { Some(id) => id, None => { - fail!("No item found: `%s`", str::connect(names, "::")); + fail!("No item found: `%s`", names.connect("::")); } }; diff --git a/src/librustc/middle/typeck/infer/to_str.rs b/src/librustc/middle/typeck/infer/to_str.rs index ef3b837e98a..d6623f06c3d 100644 --- a/src/librustc/middle/typeck/infer/to_str.rs +++ b/src/librustc/middle/typeck/infer/to_str.rs @@ -35,7 +35,7 @@ impl InferStr for ty::t { impl InferStr for FnSig { fn inf_str(&self, cx: &InferCtxt) -> ~str { fmt!("(%s) -> %s", - str::connect(self.inputs.map(|a| a.inf_str(cx)), ", "), + self.inputs.map(|a| a.inf_str(cx)).connect(", "), self.output.inf_str(cx)) } } diff --git a/src/librustc/util/common.rs b/src/librustc/util/common.rs index a44c409aa33..8d0cba0e8b7 100644 --- a/src/librustc/util/common.rs +++ b/src/librustc/util/common.rs @@ -111,7 +111,7 @@ pub fn local_rhs_span(l: @ast::local, def: span) -> span { pub fn pluralize(n: uint, s: ~str) -> ~str { if n == 1 { s } - else { str::concat([s, ~"s"]) } + else { fmt!("%ss", s) } } // A set of node IDs (used to keep track of which node IDs are for statements) diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index c72bf5c7f0b..b5e6e7e1194 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -281,7 +281,7 @@ pub fn vstore_ty_to_str(cx: ctxt, mt: &mt, vs: ty::vstore) -> ~str { pub fn tys_to_str(cx: ctxt, ts: &[t]) -> ~str { let tstrs = ts.map(|t| ty_to_str(cx, *t)); - fmt!("(%s)", str::connect(tstrs, ", ")) + fmt!("(%s)", tstrs.connect(", ")) } pub fn fn_sig_to_str(cx: ctxt, typ: &ty::FnSig) -> ~str { @@ -369,7 +369,7 @@ pub fn ty_to_str(cx: ctxt, typ: t) -> ~str { fn push_sig_to_str(cx: ctxt, s: &mut ~str, sig: &ty::FnSig) { s.push_char('('); let strs = sig.inputs.map(|a| fn_input_to_str(cx, *a)); - s.push_str(str::connect(strs, ", ")); + s.push_str(strs.connect(", ")); s.push_char(')'); if ty::get(sig.output).sty != ty_nil { s.push_str(" -> "); @@ -420,7 +420,7 @@ pub fn ty_to_str(cx: ctxt, typ: t) -> ~str { ty_type => ~"type", ty_tup(ref elems) => { let strs = elems.map(|elem| ty_to_str(cx, *elem)); - ~"(" + str::connect(strs, ",") + ")" + ~"(" + strs.connect(",") + ")" } ty_closure(ref f) => { closure_to_str(cx, f) @@ -477,7 +477,7 @@ pub fn parameterized(cx: ctxt, if tps.len() > 0u { let strs = vec::map(tps, |t| ty_to_str(cx, *t)); - fmt!("%s%s<%s>", base, r_str, str::connect(strs, ",")) + fmt!("%s%s<%s>", base, r_str, strs.connect(",")) } else { fmt!("%s%s", base, r_str) } @@ -515,7 +515,7 @@ impl Repr for ~T { */ fn repr_vec(tcx: ctxt, v: &[T]) -> ~str { - fmt!("[%s]", str::connect(v.map(|t| t.repr(tcx)), ",")) + fmt!("[%s]", v.map(|t| t.repr(tcx)).connect(",")) } impl<'self, T:Repr> Repr for &'self [T] { @@ -569,7 +569,7 @@ impl Repr for ty::ParamBounds { for self.trait_bounds.each |t| { res.push(t.repr(tcx)); } - str::connect(res, "+") + res.connect("+") } } @@ -787,7 +787,7 @@ impl UserString for ty::BuiltinBounds { for self.each |bb| { result.push(bb.user_string(tcx)); } - str::connect(result, "+") + result.connect("+") } } } diff --git a/src/librustdoc/attr_parser.rs b/src/librustdoc/attr_parser.rs index d2d9ec7d79b..47c54ee8e8f 100644 --- a/src/librustdoc/attr_parser.rs +++ b/src/librustdoc/attr_parser.rs @@ -53,7 +53,7 @@ pub fn parse_desc(attrs: ~[ast::attribute]) -> Option<~str> { if doc_strs.is_empty() { None } else { - Some(str::connect(doc_strs, "\n")) + Some(doc_strs.connect("\n")) } } diff --git a/src/librustdoc/markdown_pass.rs b/src/librustdoc/markdown_pass.rs index 976344a1825..b6917f527a1 100644 --- a/src/librustdoc/markdown_pass.rs +++ b/src/librustdoc/markdown_pass.rs @@ -173,7 +173,7 @@ pub fn header_kind(doc: doc::ItemTag) -> ~str { } pub fn header_name(doc: doc::ItemTag) -> ~str { - let fullpath = str::connect(doc.path() + [doc.name()], "::"); + let fullpath = (doc.path() + [doc.name()]).connect("::"); match &doc { &doc::ModTag(_) if doc.id() != syntax::ast::crate_node_id => { fullpath @@ -414,7 +414,7 @@ fn code_block_indent(s: ~str) -> ~str { for str::each_line_any(s) |line| { indented.push(fmt!(" %s", line)); } - str::connect(indented, "\n") + indented.connect("\n") } fn write_const( @@ -476,7 +476,7 @@ fn list_item_indent(item: &str) -> ~str { // separate markdown elements within `*` lists must be indented by four // spaces, or they will escape the list context. indenting everything // seems fine though. - str::connect_slices(indented, "\n ") + indented.connect("\n ") } fn write_trait(ctxt: &Ctxt, doc: doc::TraitDoc) { diff --git a/src/librustdoc/markdown_writer.rs b/src/librustdoc/markdown_writer.rs index 7bcfa1acdfa..35315276326 100644 --- a/src/librustdoc/markdown_writer.rs +++ b/src/librustdoc/markdown_writer.rs @@ -107,7 +107,7 @@ fn pandoc_writer( use core::io::WriterUtil; debug!("pandoc cmd: %s", pandoc_cmd); - debug!("pandoc args: %s", str::connect(pandoc_args, " ")); + debug!("pandoc args: %s", pandoc_args.connect(" ")); let mut proc = run::Process::new(pandoc_cmd, pandoc_args, run::ProcessOptions::new()); @@ -164,7 +164,7 @@ pub fn make_filename( } } doc::ItemPage(doc) => { - str::connect(doc.path() + [doc.name()], "_") + (doc.path() + [doc.name()]).connect("_") } } }; diff --git a/src/librustdoc/unindent_pass.rs b/src/librustdoc/unindent_pass.rs index ba6f7184f68..23a4b9c7ba4 100644 --- a/src/librustdoc/unindent_pass.rs +++ b/src/librustdoc/unindent_pass.rs @@ -87,7 +87,7 @@ fn unindent(s: &str) -> ~str { line.slice(min_indent, line.len()).to_owned() } }; - str::connect(unindented, "\n") + unindented.connect("\n") } else { s.to_str() } diff --git a/src/librusti/rusti.rc b/src/librusti/rusti.rc index 17caaf6bf7d..9cb98dd8c2d 100644 --- a/src/librusti/rusti.rc +++ b/src/librusti/rusti.rc @@ -308,7 +308,7 @@ fn run_cmd(repl: &mut Repl, _in: @io::Reader, _out: @io::Writer, println("no crates loaded"); } else { println(fmt!("crates loaded: %s", - str::connect(loaded_crates, ", "))); + loaded_crates.connect(", "))); } } ~"{" => { diff --git a/src/librustpkg/util.rs b/src/librustpkg/util.rs index 10d2d139a14..75e2c3fd464 100644 --- a/src/librustpkg/util.rs +++ b/src/librustpkg/util.rs @@ -207,8 +207,8 @@ pub fn compile_input(ctxt: &Ctx, let binary = @(copy os::args()[0]); - debug!("flags: %s", str::connect(flags, " ")); - debug!("cfgs: %s", str::connect(cfgs, " ")); + debug!("flags: %s", flags.connect(" ")); + debug!("cfgs: %s", cfgs.connect(" ")); debug!("compile_input's sysroot = %?", ctxt.sysroot_opt); let crate_type = match what { diff --git a/src/libstd/path.rs b/src/libstd/path.rs index 4df07830b23..d62fc8c2cba 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -22,7 +22,7 @@ use iterator::IteratorUtil; use libc; use option::{None, Option, Some}; use str; -use str::StrSlice; +use str::{StrSlice, StrVector}; use to_str::ToStr; use ascii::{AsciiCast, AsciiStr}; use old_iter::BaseIter; @@ -442,7 +442,7 @@ impl ToStr for PosixPath { if self.is_absolute { s += "/"; } - s + str::connect(self.components, "/") + s + self.components.connect("/") } } @@ -629,7 +629,7 @@ impl ToStr for WindowsPath { if self.is_absolute { s += "\\"; } - s + str::connect(self.components, "\\") + s + self.components.connect("\\") } } diff --git a/src/libstd/str.rs b/src/libstd/str.rs index 4766504813d..c820f645490 100644 --- a/src/libstd/str.rs +++ b/src/libstd/str.rs @@ -170,18 +170,6 @@ pub fn append(lhs: ~str, rhs: &str) -> ~str { v } -/// Concatenate a vector of strings -pub fn concat(v: &[~str]) -> ~str { v.concat() } - -/// Concatenate a vector of strings -pub fn concat_slices(v: &[&str]) -> ~str { v.concat() } - -/// Concatenate a vector of strings, placing a given separator between each -pub fn connect(v: &[~str], sep: &str) -> ~str { v.connect(sep) } - -/// Concatenate a vector of strings, placing a given separator between each -pub fn connect_slices(v: &[&str], sep: &str) -> ~str { v.connect(sep) } - #[allow(missing_doc)] pub trait StrVector { pub fn concat(&self) -> ~str; @@ -2495,7 +2483,6 @@ mod tests { #[test] fn test_concat() { fn t(v: &[~str], s: &str) { - assert_eq!(concat(v), s.to_str()); assert_eq!(v.concat(), s.to_str()); } t([~"you", ~"know", ~"I'm", ~"no", ~"good"], "youknowI'mnogood"); @@ -2507,7 +2494,6 @@ mod tests { #[test] fn test_connect() { fn t(v: &[~str], sep: &str, s: &str) { - assert_eq!(connect(v, sep), s.to_str()); assert_eq!(v.connect(sep), s.to_str()); } t([~"you", ~"know", ~"I'm", ~"no", ~"good"], @@ -2520,7 +2506,6 @@ mod tests { #[test] fn test_concat_slices() { fn t(v: &[&str], s: &str) { - assert_eq!(concat_slices(v), s.to_str()); assert_eq!(v.concat(), s.to_str()); } t(["you", "know", "I'm", "no", "good"], "youknowI'mnogood"); @@ -2532,7 +2517,6 @@ mod tests { #[test] fn test_connect_slices() { fn t(v: &[&str], sep: &str, s: &str) { - assert_eq!(connect_slices(v, sep), s.to_str()); assert_eq!(v.connect(sep), s.to_str()); } t(["you", "know", "I'm", "no", "good"], @@ -3307,7 +3291,6 @@ mod tests { assert_eq!(lines, ~["", "Märy häd ä little lämb", "", "Little lämb"]); } - #[test] fn test_split_str_iterator() { fn t<'a>(s: &str, sep: &'a str, u: ~[&str]) { diff --git a/src/libsyntax/abi.rs b/src/libsyntax/abi.rs index 75439dfaa78..53729dbd115 100644 --- a/src/libsyntax/abi.rs +++ b/src/libsyntax/abi.rs @@ -10,7 +10,6 @@ use core::prelude::*; -use core::str; use core::to_bytes; #[deriving(Eq)] @@ -267,7 +266,7 @@ impl ToStr for AbiSet { for self.each |abi| { strs.push(abi.data().name); } - fmt!("\"%s\"", str::connect_slices(strs, " ")) + fmt!("\"%s\"", strs.connect(" ")) } } diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs index fecded5e87b..8a379a6213a 100644 --- a/src/libsyntax/ast_map.rs +++ b/src/libsyntax/ast_map.rs @@ -62,7 +62,7 @@ pub fn path_to_str_with_sep(p: &[path_elt], sep: &str, itr: @ident_interner) path_name(s) => copy *itr.get(s.name) } }; - str::connect(strs, sep) + strs.connect(sep) } pub fn path_ident_to_str(p: &path, i: ident, itr: @ident_interner) -> ~str { diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index b040397de72..db7c29edab0 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -28,7 +28,7 @@ use core::to_bytes; pub fn path_name_i(idents: &[ident]) -> ~str { // FIXME: Bad copies (#2543 -- same for everything else that says "bad") - str::connect(idents.map(|i| copy *token::interner_get(i.name)), "::") + idents.map(|i| copy *token::interner_get(i.name)).connect("::") } pub fn path_to_ident(p: @Path) -> ident { copy *p.idents.last() } diff --git a/src/libsyntax/ext/asm.rs b/src/libsyntax/ext/asm.rs index 7f8f2be6f6e..14cbd170c48 100644 --- a/src/libsyntax/ext/asm.rs +++ b/src/libsyntax/ext/asm.rs @@ -120,7 +120,7 @@ pub fn expand_asm(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree]) clobs.push(clob); } - cons = str::connect(clobs, ","); + cons = clobs.connect(","); } Options => { let option = p.parse_str(); diff --git a/src/libsyntax/ext/pipes/liveness.rs b/src/libsyntax/ext/pipes/liveness.rs index 43bcb68b8e0..cb7386b9880 100644 --- a/src/libsyntax/ext/pipes/liveness.rs +++ b/src/libsyntax/ext/pipes/liveness.rs @@ -88,7 +88,7 @@ pub fn analyze(proto: @mut protocol_, _cx: @ExtCtxt) { } if self_live.len() > 0 { - let states = str::connect(self_live.map(|s| copy s.name), " "); + let states = self_live.map(|s| copy s.name).connect(" "); debug!("protocol %s is unbounded due to loops involving: %s", copy proto.name, states); diff --git a/src/libsyntax/ext/pipes/pipec.rs b/src/libsyntax/ext/pipes/pipec.rs index a5725613d58..304c496bbf4 100644 --- a/src/libsyntax/ext/pipes/pipec.rs +++ b/src/libsyntax/ext/pipes/pipec.rs @@ -24,7 +24,6 @@ use opt_vec; use opt_vec::OptVec; use core::iterator::IteratorUtil; -use core::str; use core::vec; pub trait gen_send { @@ -100,9 +99,9 @@ impl gen_send for message { } body += fmt!("let message = %s(%s);\n", name, - str::connect(vec::append_one( - arg_names.map(|x| cx.str_of(*x)), - ~"s"), ", ")); + vec::append_one( + arg_names.map(|x| cx.str_of(*x)), + ~"s").connect(", ")); if !try { body += fmt!("::std::pipes::send(pipe, message);\n"); @@ -155,8 +154,7 @@ impl gen_send for message { ~"" } else { - ~"(" + str::connect(arg_names.map(|x| copy *x), - ", ") + ")" + ~"(" + arg_names.map(|x| copy *x).connect(", ") + ")" }; let mut body = ~"{ "; diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index 09c9dd922c7..2c6f40091ac 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -92,7 +92,7 @@ pub mod rt { impl<'self> ToSource for &'self [@ast::item] { fn to_source(&self) -> ~str { - str::connect(self.map(|i| i.to_source()), "\n\n") + self.map(|i| i.to_source()).connect("\n\n") } } @@ -104,7 +104,7 @@ pub mod rt { impl<'self> ToSource for &'self [@ast::Ty] { fn to_source(&self) -> ~str { - str::connect(self.map(|i| i.to_source()), ", ") + self.map(|i| i.to_source()).connect(", ") } } diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs index 4d1e9a31821..79018ebd1ea 100644 --- a/src/libsyntax/ext/source_util.rs +++ b/src/libsyntax/ext/source_util.rs @@ -23,7 +23,6 @@ use print::pprust; use core::io; use core::result; -use core::str; use core::vec; // These macros all relate to the file system; they either return @@ -74,8 +73,7 @@ pub fn expand_mod(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree]) -> base::MacResult { base::check_zero_tts(cx, sp, tts, "module_path!"); base::MRExpr(cx.expr_str(sp, - str::connect(cx.mod_path().map( - |x| cx.str_of(*x)), "::"))) + cx.mod_path().map(|x| cx.str_of(*x)).connect("::"))) } // include! : parse the given file as an expr diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index a6ec91f899c..0c9ca98fb9d 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -371,7 +371,7 @@ pub fn parse( } else { if (bb_eis.len() > 0u && next_eis.len() > 0u) || bb_eis.len() > 1u { - let nts = str::connect(vec::map(bb_eis, |ei| { + let nts = vec::map(bb_eis.connect(|ei| { match ei.elts[ei.idx].node { match_nonterminal(ref bind,ref name,_) => { fmt!("%s ('%s')", *ident_to_str(name), diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs index 89fd5c3762a..a6933c16483 100644 --- a/src/libsyntax/parse/comments.rs +++ b/src/libsyntax/parse/comments.rs @@ -116,7 +116,7 @@ pub fn strip_doc_comment_decoration(comment: &str) -> ~str { let lines = block_trim(lines, ~"\t ", None); let lines = block_trim(lines, ~"*", Some(1u)); let lines = block_trim(lines, ~"\t ", None); - return str::connect(lines, "\n"); + return lines.connect("\n"); } fail!("not a doc-comment: %s", comment); diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 3ff894c267b..03b4c0c5ca1 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -4002,9 +4002,7 @@ impl Parser { fmt!("illegal ABI: \ expected one of [%s], \ found `%s`", - str::connect_slices( - abi::all_names(), - ", "), + abi::all_names().connect(", "), word)); } } diff --git a/src/test/run-pass/issue-3563-3.rs b/src/test/run-pass/issue-3563-3.rs index 10d448b7952..36872560716 100644 --- a/src/test/run-pass/issue-3563-3.rs +++ b/src/test/run-pass/issue-3563-3.rs @@ -120,7 +120,7 @@ impl ToStr for AsciiArt { let lines = do self.lines.map |line| {str::from_chars(*line)}; // Concatenate the lines together using a new-line. - str::connect(lines, "\n") + lines.connect("\n") } } diff --git a/src/test/run-pass/issue-4241.rs b/src/test/run-pass/issue-4241.rs index 972b9c7a525..23e5f3945b1 100644 --- a/src/test/run-pass/issue-4241.rs +++ b/src/test/run-pass/issue-4241.rs @@ -98,8 +98,8 @@ priv fn cmd_to_str(cmd: ~[~str]) -> ~str { res.push_str(cmd.len().to_str()); res.push_str("\r\n"); for cmd.each |s| { - res.push_str(str::concat(~[~"$", s.len().to_str(), ~"\r\n", - copy *s, ~"\r\n"])); + res.push_str([~"$", s.len().to_str(), ~"\r\n", + copy *s, ~"\r\n"].concat())); } res } diff --git a/src/test/run-pass/trait-to-str.rs b/src/test/run-pass/trait-to-str.rs index 9b94b785125..bc167e5124f 100644 --- a/src/test/run-pass/trait-to-str.rs +++ b/src/test/run-pass/trait-to-str.rs @@ -26,7 +26,7 @@ impl to_str for int { impl to_str for ~[T] { fn to_str(&self) -> ~str { - ~"[" + str::connect(vec::map(*self, |e| e.to_str() ), ", ") + "]" + ~"[" + self.map(|e| e.to_str()).connect(", ") + "]" } }