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)
#[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
// 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
}
}
}
- return str::connect(strvec, "&");
+ return strvec.connect("&");
}
// returns the scheme and the rest of the url, or a parsing error
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()
}
}
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(".")
}
}
}
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();
}
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();
}
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
revoke_clean(bcx, *c);
}
- let mut constraints = str::connect(constraints, ",");
+ let mut constraints = constraints.connect(",");
let mut clobbers = getClobbers();
if *ia.clobbers != ~"" && clobbers != ~"" {
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);
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 {
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 {
} else {
"s"
},
- str::connect(missing_fields, ", ")));
+ missing_fields.connect(", ")));
}
}
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("::"));
}
};
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))
}
}
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)
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 {
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(" -> ");
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)
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)
}
*/
fn repr_vec<T:Repr>(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] {
for self.trait_bounds.each |t| {
res.push(t.repr(tcx));
}
- str::connect(res, "+")
+ res.connect("+")
}
}
for self.each |bb| {
result.push(bb.user_string(tcx));
}
- str::connect(result, "+")
+ result.connect("+")
}
}
}
if doc_strs.is_empty() {
None
} else {
- Some(str::connect(doc_strs, "\n"))
+ Some(doc_strs.connect("\n"))
}
}
}
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
for str::each_line_any(s) |line| {
indented.push(fmt!(" %s", line));
}
- str::connect(indented, "\n")
+ indented.connect("\n")
}
fn write_const(
// 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) {
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());
}
}
doc::ItemPage(doc) => {
- str::connect(doc.path() + [doc.name()], "_")
+ (doc.path() + [doc.name()]).connect("_")
}
}
};
line.slice(min_indent, line.len()).to_owned()
}
};
- str::connect(unindented, "\n")
+ unindented.connect("\n")
} else {
s.to_str()
}
println("no crates loaded");
} else {
println(fmt!("crates loaded: %s",
- str::connect(loaded_crates, ", ")));
+ loaded_crates.connect(", ")));
}
}
~"{" => {
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 {
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;
if self.is_absolute {
s += "/";
}
- s + str::connect(self.components, "/")
+ s + self.components.connect("/")
}
}
if self.is_absolute {
s += "\\";
}
- s + str::connect(self.components, "\\")
+ s + self.components.connect("\\")
}
}
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;
#[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");
#[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"],
#[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");
#[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"],
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]) {
use core::prelude::*;
-use core::str;
use core::to_bytes;
#[deriving(Eq)]
for self.each |abi| {
strs.push(abi.data().name);
}
- fmt!("\"%s\"", str::connect_slices(strs, " "))
+ fmt!("\"%s\"", strs.connect(" "))
}
}
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 {
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() }
clobs.push(clob);
}
- cons = str::connect(clobs, ",");
+ cons = clobs.connect(",");
}
Options => {
let option = p.parse_str();
}
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);
use opt_vec::OptVec;
use core::iterator::IteratorUtil;
-use core::str;
use core::vec;
pub trait gen_send {
}
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");
~""
}
else {
- ~"(" + str::connect(arg_names.map(|x| copy *x),
- ", ") + ")"
+ ~"(" + arg_names.map(|x| copy *x).connect(", ") + ")"
};
let mut body = ~"{ ";
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")
}
}
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(", ")
}
}
use core::io;
use core::result;
-use core::str;
use core::vec;
// These macros all relate to the file system; they either return
-> 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
} 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),
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);
fmt!("illegal ABI: \
expected one of [%s], \
found `%s`",
- str::connect_slices(
- abi::all_names(),
- ", "),
+ abi::all_names().connect(", "),
word));
}
}
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")
}
}
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
}
impl<T:to_str> 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(", ") + "]"
}
}