std: remove str::{connect,concat}*.
This commit is contained in:
parent
5a711ea7c3
commit
ccd0ac59e9
38 changed files with 62 additions and 86 deletions
|
@ -244,7 +244,7 @@ fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
|
||||||
None => copy *config
|
None => copy *config
|
||||||
};
|
};
|
||||||
let config = &mut 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;
|
let check_lines = copy props.check_lines;
|
||||||
|
|
||||||
// compile test file (it shoud have 'compile-flags:-g' in the header)
|
// 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 = "macos")]
|
||||||
#[cfg(target_os = "freebsd")]
|
#[cfg(target_os = "freebsd")]
|
||||||
fn make_cmdline(_libpath: &str, prog: &str, args: &[~str]) -> ~str {
|
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")]
|
#[cfg(target_os = "win32")]
|
||||||
fn make_cmdline(libpath: &str, prog: &str, args: &[~str]) -> ~str {
|
fn make_cmdline(libpath: &str, prog: &str, args: &[~str]) -> ~str {
|
||||||
fmt!("%s %s %s", lib_path_cmd_prefix(libpath), prog,
|
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
|
// Build the LD_LIBRARY_PATH variable as it would be seen on the command line
|
||||||
|
|
|
@ -648,14 +648,14 @@ pub mod groups {
|
||||||
|
|
||||||
// FIXME: #5516
|
// FIXME: #5516
|
||||||
// wrapped description
|
// wrapped description
|
||||||
row += str::connect(desc_rows, desc_sep);
|
row += desc_rows.connect(desc_sep);
|
||||||
|
|
||||||
row
|
row
|
||||||
});
|
});
|
||||||
|
|
||||||
return str::to_owned(brief) +
|
return str::to_owned(brief) +
|
||||||
"\n\nOptions:\n" +
|
"\n\nOptions:\n" +
|
||||||
str::connect(rows, "\n") +
|
rows.connect("\n") +
|
||||||
"\n\n";
|
"\n\n";
|
||||||
}
|
}
|
||||||
} // end groups module
|
} // end groups module
|
||||||
|
|
|
@ -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
|
// returns the scheme and the rest of the url, or a parsing error
|
||||||
|
|
|
@ -520,10 +520,10 @@ impl ToStrRadix for BigUint {
|
||||||
|
|
||||||
fn fill_concat(v: &[BigDigit], radix: uint, l: uint) -> ~str {
|
fn fill_concat(v: &[BigDigit], radix: uint, l: uint) -> ~str {
|
||||||
if v.is_empty() { return ~"0" }
|
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);
|
let s = uint::to_str_radix(*n as uint, radix);
|
||||||
str::from_chars(vec::from_elem(l - s.len(), '0')) + s
|
str::from_chars(vec::from_elem(l - s.len(), '0')) + s
|
||||||
}));
|
}).concat();
|
||||||
s.trim_left_chars(['0']).to_owned()
|
s.trim_left_chars(['0']).to_owned()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,12 +81,12 @@ impl ToStr for Version {
|
||||||
let s = if self.pre.is_empty() {
|
let s = if self.pre.is_empty() {
|
||||||
s
|
s
|
||||||
} else {
|
} 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() {
|
if self.build.is_empty() {
|
||||||
s
|
s
|
||||||
} else {
|
} else {
|
||||||
s + "+" + str::connect(self.build.map(|i| i.to_str()), ".")
|
s + "+" + self.build.map(|i| i.to_str()).connect(".")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -394,7 +394,7 @@ pub mod write {
|
||||||
sess.err(fmt!("building with `%s` failed with code %d",
|
sess.err(fmt!("building with `%s` failed with code %d",
|
||||||
cc_prog, prog.status));
|
cc_prog, prog.status));
|
||||||
sess.note(fmt!("%s arguments: %s",
|
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.note(str::from_bytes(prog.error + prog.output));
|
||||||
sess.abort_if_errors();
|
sess.abort_if_errors();
|
||||||
}
|
}
|
||||||
|
@ -809,14 +809,14 @@ pub fn link_binary(sess: Session,
|
||||||
|
|
||||||
debug!("output: %s", output.to_str());
|
debug!("output: %s", output.to_str());
|
||||||
let cc_args = link_args(sess, obj_filename, out_filename, lm);
|
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
|
// We run 'cc' here
|
||||||
let prog = run::process_output(cc_prog, cc_args);
|
let prog = run::process_output(cc_prog, cc_args);
|
||||||
if 0 != prog.status {
|
if 0 != prog.status {
|
||||||
sess.err(fmt!("linking with `%s` failed with code %d",
|
sess.err(fmt!("linking with `%s` failed with code %d",
|
||||||
cc_prog, prog.status));
|
cc_prog, prog.status));
|
||||||
sess.note(fmt!("%s arguments: %s",
|
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.note(str::from_bytes(prog.error + prog.output));
|
||||||
sess.abort_if_errors();
|
sess.abort_if_errors();
|
||||||
}
|
}
|
||||||
|
|
|
@ -328,8 +328,8 @@ pub fn compile_rest(sess: Session,
|
||||||
|
|
||||||
let outputs = outputs.get_ref();
|
let outputs = outputs.get_ref();
|
||||||
if (sess.opts.debugging_opts & session::print_link_args) != 0 {
|
if (sess.opts.debugging_opts & session::print_link_args) != 0 {
|
||||||
io::println(str::connect(link::link_args(sess,
|
io::println(link::link_args(sess, &outputs.obj_filename,
|
||||||
&outputs.obj_filename, &outputs.out_filename, link_meta), " "));
|
&outputs.out_filename, link_meta).connect(" "));
|
||||||
}
|
}
|
||||||
|
|
||||||
// NB: Android hack
|
// NB: Android hack
|
||||||
|
|
|
@ -87,7 +87,7 @@ pub fn trans_inline_asm(bcx: block, ia: &ast::inline_asm) -> block {
|
||||||
revoke_clean(bcx, *c);
|
revoke_clean(bcx, *c);
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut constraints = str::connect(constraints, ",");
|
let mut constraints = constraints.connect(",");
|
||||||
|
|
||||||
let mut clobbers = getClobbers();
|
let mut clobbers = getClobbers();
|
||||||
if *ia.clobbers != ~"" && clobbers != ~"" {
|
if *ia.clobbers != ~"" && clobbers != ~"" {
|
||||||
|
|
|
@ -1995,7 +1995,7 @@ pub fn trans_enum_variant(ccx: @CrateContext,
|
||||||
|
|
||||||
debug!("trans_enum_variant: name=%s tps=%s repr=%? enum_ty=%s",
|
debug!("trans_enum_variant: name=%s tps=%s repr=%? enum_ty=%s",
|
||||||
unsafe { str::raw::from_c_str(llvm::LLVMGetValueName(llfndecl)) },
|
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));
|
repr, ty_to_str(ccx.tcx, enum_ty));
|
||||||
|
|
||||||
adt::trans_start_init(bcx, repr, fcx.llretptr.get(), disr);
|
adt::trans_start_init(bcx, repr, fcx.llretptr.get(), disr);
|
||||||
|
|
|
@ -192,7 +192,7 @@ pub fn Invoke(cx: block,
|
||||||
terminate(cx, "Invoke");
|
terminate(cx, "Invoke");
|
||||||
debug!("Invoke(%s with arguments (%s))",
|
debug!("Invoke(%s with arguments (%s))",
|
||||||
val_str(cx.ccx().tn, Fn),
|
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()),
|
*a).to_owned()),
|
||||||
", "));
|
", "));
|
||||||
unsafe {
|
unsafe {
|
||||||
|
|
|
@ -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)) {
|
if !params.all(|t| !ty::type_needs_infer(*t)) {
|
||||||
bcx.sess().bug(
|
bcx.sess().bug(
|
||||||
fmt!("Type parameters for node %d include inference types: %s",
|
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 {
|
match bcx.fcx.param_substs {
|
||||||
|
|
|
@ -1879,7 +1879,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
|
||||||
} else {
|
} else {
|
||||||
"s"
|
"s"
|
||||||
},
|
},
|
||||||
str::connect(missing_fields, ", ")));
|
missing_fields.connect(", ")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,7 @@ impl Env {
|
||||||
return match search_mod(self, &self.crate.node.module, 0, names) {
|
return match search_mod(self, &self.crate.node.module, 0, names) {
|
||||||
Some(id) => id,
|
Some(id) => id,
|
||||||
None => {
|
None => {
|
||||||
fail!("No item found: `%s`", str::connect(names, "::"));
|
fail!("No item found: `%s`", names.connect("::"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ impl InferStr for ty::t {
|
||||||
impl InferStr for FnSig {
|
impl InferStr for FnSig {
|
||||||
fn inf_str(&self, cx: &InferCtxt) -> ~str {
|
fn inf_str(&self, cx: &InferCtxt) -> ~str {
|
||||||
fmt!("(%s) -> %s",
|
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))
|
self.output.inf_str(cx))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,7 +111,7 @@ pub fn local_rhs_span(l: @ast::local, def: span) -> span {
|
||||||
|
|
||||||
pub fn pluralize(n: uint, s: ~str) -> ~str {
|
pub fn pluralize(n: uint, s: ~str) -> ~str {
|
||||||
if n == 1 { s }
|
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)
|
// A set of node IDs (used to keep track of which node IDs are for statements)
|
||||||
|
|
|
@ -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 {
|
pub fn tys_to_str(cx: ctxt, ts: &[t]) -> ~str {
|
||||||
let tstrs = ts.map(|t| ty_to_str(cx, *t));
|
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 {
|
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) {
|
fn push_sig_to_str(cx: ctxt, s: &mut ~str, sig: &ty::FnSig) {
|
||||||
s.push_char('(');
|
s.push_char('(');
|
||||||
let strs = sig.inputs.map(|a| fn_input_to_str(cx, *a));
|
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(')');
|
s.push_char(')');
|
||||||
if ty::get(sig.output).sty != ty_nil {
|
if ty::get(sig.output).sty != ty_nil {
|
||||||
s.push_str(" -> ");
|
s.push_str(" -> ");
|
||||||
|
@ -420,7 +420,7 @@ pub fn ty_to_str(cx: ctxt, typ: t) -> ~str {
|
||||||
ty_type => ~"type",
|
ty_type => ~"type",
|
||||||
ty_tup(ref elems) => {
|
ty_tup(ref elems) => {
|
||||||
let strs = elems.map(|elem| ty_to_str(cx, *elem));
|
let strs = elems.map(|elem| ty_to_str(cx, *elem));
|
||||||
~"(" + str::connect(strs, ",") + ")"
|
~"(" + strs.connect(",") + ")"
|
||||||
}
|
}
|
||||||
ty_closure(ref f) => {
|
ty_closure(ref f) => {
|
||||||
closure_to_str(cx, f)
|
closure_to_str(cx, f)
|
||||||
|
@ -477,7 +477,7 @@ pub fn parameterized(cx: ctxt,
|
||||||
|
|
||||||
if tps.len() > 0u {
|
if tps.len() > 0u {
|
||||||
let strs = vec::map(tps, |t| ty_to_str(cx, *t));
|
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 {
|
} else {
|
||||||
fmt!("%s%s", base, r_str)
|
fmt!("%s%s", base, r_str)
|
||||||
}
|
}
|
||||||
|
@ -515,7 +515,7 @@ impl<T:Repr> Repr for ~T {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fn repr_vec<T:Repr>(tcx: ctxt, v: &[T]) -> ~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] {
|
impl<'self, T:Repr> Repr for &'self [T] {
|
||||||
|
@ -569,7 +569,7 @@ impl Repr for ty::ParamBounds {
|
||||||
for self.trait_bounds.each |t| {
|
for self.trait_bounds.each |t| {
|
||||||
res.push(t.repr(tcx));
|
res.push(t.repr(tcx));
|
||||||
}
|
}
|
||||||
str::connect(res, "+")
|
res.connect("+")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -787,7 +787,7 @@ impl UserString for ty::BuiltinBounds {
|
||||||
for self.each |bb| {
|
for self.each |bb| {
|
||||||
result.push(bb.user_string(tcx));
|
result.push(bb.user_string(tcx));
|
||||||
}
|
}
|
||||||
str::connect(result, "+")
|
result.connect("+")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ pub fn parse_desc(attrs: ~[ast::attribute]) -> Option<~str> {
|
||||||
if doc_strs.is_empty() {
|
if doc_strs.is_empty() {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
Some(str::connect(doc_strs, "\n"))
|
Some(doc_strs.connect("\n"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -173,7 +173,7 @@ pub fn header_kind(doc: doc::ItemTag) -> ~str {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn header_name(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 {
|
match &doc {
|
||||||
&doc::ModTag(_) if doc.id() != syntax::ast::crate_node_id => {
|
&doc::ModTag(_) if doc.id() != syntax::ast::crate_node_id => {
|
||||||
fullpath
|
fullpath
|
||||||
|
@ -414,7 +414,7 @@ fn code_block_indent(s: ~str) -> ~str {
|
||||||
for str::each_line_any(s) |line| {
|
for str::each_line_any(s) |line| {
|
||||||
indented.push(fmt!(" %s", line));
|
indented.push(fmt!(" %s", line));
|
||||||
}
|
}
|
||||||
str::connect(indented, "\n")
|
indented.connect("\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn write_const(
|
fn write_const(
|
||||||
|
@ -476,7 +476,7 @@ fn list_item_indent(item: &str) -> ~str {
|
||||||
// separate markdown elements within `*` lists must be indented by four
|
// separate markdown elements within `*` lists must be indented by four
|
||||||
// spaces, or they will escape the list context. indenting everything
|
// spaces, or they will escape the list context. indenting everything
|
||||||
// seems fine though.
|
// seems fine though.
|
||||||
str::connect_slices(indented, "\n ")
|
indented.connect("\n ")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn write_trait(ctxt: &Ctxt, doc: doc::TraitDoc) {
|
fn write_trait(ctxt: &Ctxt, doc: doc::TraitDoc) {
|
||||||
|
|
|
@ -107,7 +107,7 @@ fn pandoc_writer(
|
||||||
use core::io::WriterUtil;
|
use core::io::WriterUtil;
|
||||||
|
|
||||||
debug!("pandoc cmd: %s", pandoc_cmd);
|
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());
|
let mut proc = run::Process::new(pandoc_cmd, pandoc_args, run::ProcessOptions::new());
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ pub fn make_filename(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
doc::ItemPage(doc) => {
|
doc::ItemPage(doc) => {
|
||||||
str::connect(doc.path() + [doc.name()], "_")
|
(doc.path() + [doc.name()]).connect("_")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -87,7 +87,7 @@ fn unindent(s: &str) -> ~str {
|
||||||
line.slice(min_indent, line.len()).to_owned()
|
line.slice(min_indent, line.len()).to_owned()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
str::connect(unindented, "\n")
|
unindented.connect("\n")
|
||||||
} else {
|
} else {
|
||||||
s.to_str()
|
s.to_str()
|
||||||
}
|
}
|
||||||
|
|
|
@ -308,7 +308,7 @@ fn run_cmd(repl: &mut Repl, _in: @io::Reader, _out: @io::Writer,
|
||||||
println("no crates loaded");
|
println("no crates loaded");
|
||||||
} else {
|
} else {
|
||||||
println(fmt!("crates loaded: %s",
|
println(fmt!("crates loaded: %s",
|
||||||
str::connect(loaded_crates, ", ")));
|
loaded_crates.connect(", ")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
~"{" => {
|
~"{" => {
|
||||||
|
|
|
@ -207,8 +207,8 @@ pub fn compile_input(ctxt: &Ctx,
|
||||||
|
|
||||||
let binary = @(copy os::args()[0]);
|
let binary = @(copy os::args()[0]);
|
||||||
|
|
||||||
debug!("flags: %s", str::connect(flags, " "));
|
debug!("flags: %s", flags.connect(" "));
|
||||||
debug!("cfgs: %s", str::connect(cfgs, " "));
|
debug!("cfgs: %s", cfgs.connect(" "));
|
||||||
debug!("compile_input's sysroot = %?", ctxt.sysroot_opt);
|
debug!("compile_input's sysroot = %?", ctxt.sysroot_opt);
|
||||||
|
|
||||||
let crate_type = match what {
|
let crate_type = match what {
|
||||||
|
|
|
@ -22,7 +22,7 @@ use iterator::IteratorUtil;
|
||||||
use libc;
|
use libc;
|
||||||
use option::{None, Option, Some};
|
use option::{None, Option, Some};
|
||||||
use str;
|
use str;
|
||||||
use str::StrSlice;
|
use str::{StrSlice, StrVector};
|
||||||
use to_str::ToStr;
|
use to_str::ToStr;
|
||||||
use ascii::{AsciiCast, AsciiStr};
|
use ascii::{AsciiCast, AsciiStr};
|
||||||
use old_iter::BaseIter;
|
use old_iter::BaseIter;
|
||||||
|
@ -442,7 +442,7 @@ impl ToStr for PosixPath {
|
||||||
if self.is_absolute {
|
if self.is_absolute {
|
||||||
s += "/";
|
s += "/";
|
||||||
}
|
}
|
||||||
s + str::connect(self.components, "/")
|
s + self.components.connect("/")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -629,7 +629,7 @@ impl ToStr for WindowsPath {
|
||||||
if self.is_absolute {
|
if self.is_absolute {
|
||||||
s += "\\";
|
s += "\\";
|
||||||
}
|
}
|
||||||
s + str::connect(self.components, "\\")
|
s + self.components.connect("\\")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -170,18 +170,6 @@ pub fn append(lhs: ~str, rhs: &str) -> ~str {
|
||||||
v
|
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)]
|
#[allow(missing_doc)]
|
||||||
pub trait StrVector {
|
pub trait StrVector {
|
||||||
pub fn concat(&self) -> ~str;
|
pub fn concat(&self) -> ~str;
|
||||||
|
@ -2495,7 +2483,6 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_concat() {
|
fn test_concat() {
|
||||||
fn t(v: &[~str], s: &str) {
|
fn t(v: &[~str], s: &str) {
|
||||||
assert_eq!(concat(v), s.to_str());
|
|
||||||
assert_eq!(v.concat(), s.to_str());
|
assert_eq!(v.concat(), s.to_str());
|
||||||
}
|
}
|
||||||
t([~"you", ~"know", ~"I'm", ~"no", ~"good"], "youknowI'mnogood");
|
t([~"you", ~"know", ~"I'm", ~"no", ~"good"], "youknowI'mnogood");
|
||||||
|
@ -2507,7 +2494,6 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_connect() {
|
fn test_connect() {
|
||||||
fn t(v: &[~str], sep: &str, s: &str) {
|
fn t(v: &[~str], sep: &str, s: &str) {
|
||||||
assert_eq!(connect(v, sep), s.to_str());
|
|
||||||
assert_eq!(v.connect(sep), s.to_str());
|
assert_eq!(v.connect(sep), s.to_str());
|
||||||
}
|
}
|
||||||
t([~"you", ~"know", ~"I'm", ~"no", ~"good"],
|
t([~"you", ~"know", ~"I'm", ~"no", ~"good"],
|
||||||
|
@ -2520,7 +2506,6 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_concat_slices() {
|
fn test_concat_slices() {
|
||||||
fn t(v: &[&str], s: &str) {
|
fn t(v: &[&str], s: &str) {
|
||||||
assert_eq!(concat_slices(v), s.to_str());
|
|
||||||
assert_eq!(v.concat(), s.to_str());
|
assert_eq!(v.concat(), s.to_str());
|
||||||
}
|
}
|
||||||
t(["you", "know", "I'm", "no", "good"], "youknowI'mnogood");
|
t(["you", "know", "I'm", "no", "good"], "youknowI'mnogood");
|
||||||
|
@ -2532,7 +2517,6 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_connect_slices() {
|
fn test_connect_slices() {
|
||||||
fn t(v: &[&str], sep: &str, s: &str) {
|
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());
|
assert_eq!(v.connect(sep), s.to_str());
|
||||||
}
|
}
|
||||||
t(["you", "know", "I'm", "no", "good"],
|
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"]);
|
assert_eq!(lines, ~["", "Märy häd ä little lämb", "", "Little lämb"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_split_str_iterator() {
|
fn test_split_str_iterator() {
|
||||||
fn t<'a>(s: &str, sep: &'a str, u: ~[&str]) {
|
fn t<'a>(s: &str, sep: &'a str, u: ~[&str]) {
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
use core::prelude::*;
|
use core::prelude::*;
|
||||||
|
|
||||||
use core::str;
|
|
||||||
use core::to_bytes;
|
use core::to_bytes;
|
||||||
|
|
||||||
#[deriving(Eq)]
|
#[deriving(Eq)]
|
||||||
|
@ -267,7 +266,7 @@ impl ToStr for AbiSet {
|
||||||
for self.each |abi| {
|
for self.each |abi| {
|
||||||
strs.push(abi.data().name);
|
strs.push(abi.data().name);
|
||||||
}
|
}
|
||||||
fmt!("\"%s\"", str::connect_slices(strs, " "))
|
fmt!("\"%s\"", strs.connect(" "))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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)
|
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_ident_to_str(p: &path, i: ident, itr: @ident_interner) -> ~str {
|
||||||
|
|
|
@ -28,7 +28,7 @@ use core::to_bytes;
|
||||||
|
|
||||||
pub fn path_name_i(idents: &[ident]) -> ~str {
|
pub fn path_name_i(idents: &[ident]) -> ~str {
|
||||||
// FIXME: Bad copies (#2543 -- same for everything else that says "bad")
|
// 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() }
|
pub fn path_to_ident(p: @Path) -> ident { copy *p.idents.last() }
|
||||||
|
|
|
@ -120,7 +120,7 @@ pub fn expand_asm(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree])
|
||||||
clobs.push(clob);
|
clobs.push(clob);
|
||||||
}
|
}
|
||||||
|
|
||||||
cons = str::connect(clobs, ",");
|
cons = clobs.connect(",");
|
||||||
}
|
}
|
||||||
Options => {
|
Options => {
|
||||||
let option = p.parse_str();
|
let option = p.parse_str();
|
||||||
|
|
|
@ -88,7 +88,7 @@ pub fn analyze(proto: @mut protocol_, _cx: @ExtCtxt) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if self_live.len() > 0 {
|
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",
|
debug!("protocol %s is unbounded due to loops involving: %s",
|
||||||
copy proto.name, states);
|
copy proto.name, states);
|
||||||
|
|
|
@ -24,7 +24,6 @@ use opt_vec;
|
||||||
use opt_vec::OptVec;
|
use opt_vec::OptVec;
|
||||||
|
|
||||||
use core::iterator::IteratorUtil;
|
use core::iterator::IteratorUtil;
|
||||||
use core::str;
|
|
||||||
use core::vec;
|
use core::vec;
|
||||||
|
|
||||||
pub trait gen_send {
|
pub trait gen_send {
|
||||||
|
@ -100,9 +99,9 @@ impl gen_send for message {
|
||||||
}
|
}
|
||||||
body += fmt!("let message = %s(%s);\n",
|
body += fmt!("let message = %s(%s);\n",
|
||||||
name,
|
name,
|
||||||
str::connect(vec::append_one(
|
vec::append_one(
|
||||||
arg_names.map(|x| cx.str_of(*x)),
|
arg_names.map(|x| cx.str_of(*x)),
|
||||||
~"s"), ", "));
|
~"s").connect(", "));
|
||||||
|
|
||||||
if !try {
|
if !try {
|
||||||
body += fmt!("::std::pipes::send(pipe, message);\n");
|
body += fmt!("::std::pipes::send(pipe, message);\n");
|
||||||
|
@ -155,8 +154,7 @@ impl gen_send for message {
|
||||||
~""
|
~""
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
~"(" + str::connect(arg_names.map(|x| copy *x),
|
~"(" + arg_names.map(|x| copy *x).connect(", ") + ")"
|
||||||
", ") + ")"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut body = ~"{ ";
|
let mut body = ~"{ ";
|
||||||
|
|
|
@ -92,7 +92,7 @@ pub mod rt {
|
||||||
|
|
||||||
impl<'self> ToSource for &'self [@ast::item] {
|
impl<'self> ToSource for &'self [@ast::item] {
|
||||||
fn to_source(&self) -> ~str {
|
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] {
|
impl<'self> ToSource for &'self [@ast::Ty] {
|
||||||
fn to_source(&self) -> ~str {
|
fn to_source(&self) -> ~str {
|
||||||
str::connect(self.map(|i| i.to_source()), ", ")
|
self.map(|i| i.to_source()).connect(", ")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,6 @@ use print::pprust;
|
||||||
|
|
||||||
use core::io;
|
use core::io;
|
||||||
use core::result;
|
use core::result;
|
||||||
use core::str;
|
|
||||||
use core::vec;
|
use core::vec;
|
||||||
|
|
||||||
// These macros all relate to the file system; they either return
|
// 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::MacResult {
|
||||||
base::check_zero_tts(cx, sp, tts, "module_path!");
|
base::check_zero_tts(cx, sp, tts, "module_path!");
|
||||||
base::MRExpr(cx.expr_str(sp,
|
base::MRExpr(cx.expr_str(sp,
|
||||||
str::connect(cx.mod_path().map(
|
cx.mod_path().map(|x| cx.str_of(*x)).connect("::")))
|
||||||
|x| cx.str_of(*x)), "::")))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// include! : parse the given file as an expr
|
// include! : parse the given file as an expr
|
||||||
|
|
|
@ -371,7 +371,7 @@ pub fn parse(
|
||||||
} else {
|
} else {
|
||||||
if (bb_eis.len() > 0u && next_eis.len() > 0u)
|
if (bb_eis.len() > 0u && next_eis.len() > 0u)
|
||||||
|| bb_eis.len() > 1u {
|
|| 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 ei.elts[ei.idx].node {
|
||||||
match_nonterminal(ref bind,ref name,_) => {
|
match_nonterminal(ref bind,ref name,_) => {
|
||||||
fmt!("%s ('%s')", *ident_to_str(name),
|
fmt!("%s ('%s')", *ident_to_str(name),
|
||||||
|
|
|
@ -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, ~"\t ", None);
|
||||||
let lines = block_trim(lines, ~"*", Some(1u));
|
let lines = block_trim(lines, ~"*", Some(1u));
|
||||||
let lines = block_trim(lines, ~"\t ", None);
|
let lines = block_trim(lines, ~"\t ", None);
|
||||||
return str::connect(lines, "\n");
|
return lines.connect("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
fail!("not a doc-comment: %s", comment);
|
fail!("not a doc-comment: %s", comment);
|
||||||
|
|
|
@ -4002,9 +4002,7 @@ impl Parser {
|
||||||
fmt!("illegal ABI: \
|
fmt!("illegal ABI: \
|
||||||
expected one of [%s], \
|
expected one of [%s], \
|
||||||
found `%s`",
|
found `%s`",
|
||||||
str::connect_slices(
|
abi::all_names().connect(", "),
|
||||||
abi::all_names(),
|
|
||||||
", "),
|
|
||||||
word));
|
word));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,7 +120,7 @@ impl ToStr for AsciiArt {
|
||||||
let lines = do self.lines.map |line| {str::from_chars(*line)};
|
let lines = do self.lines.map |line| {str::from_chars(*line)};
|
||||||
|
|
||||||
// Concatenate the lines together using a new-line.
|
// Concatenate the lines together using a new-line.
|
||||||
str::connect(lines, "\n")
|
lines.connect("\n")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,8 +98,8 @@ priv fn cmd_to_str(cmd: ~[~str]) -> ~str {
|
||||||
res.push_str(cmd.len().to_str());
|
res.push_str(cmd.len().to_str());
|
||||||
res.push_str("\r\n");
|
res.push_str("\r\n");
|
||||||
for cmd.each |s| {
|
for cmd.each |s| {
|
||||||
res.push_str(str::concat(~[~"$", s.len().to_str(), ~"\r\n",
|
res.push_str([~"$", s.len().to_str(), ~"\r\n",
|
||||||
copy *s, ~"\r\n"]));
|
copy *s, ~"\r\n"].concat()));
|
||||||
}
|
}
|
||||||
res
|
res
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ impl to_str for int {
|
||||||
|
|
||||||
impl<T:to_str> to_str for ~[T] {
|
impl<T:to_str> to_str for ~[T] {
|
||||||
fn to_str(&self) -> ~str {
|
fn to_str(&self) -> ~str {
|
||||||
~"[" + str::connect(vec::map(*self, |e| e.to_str() ), ", ") + "]"
|
~"[" + self.map(|e| e.to_str()).connect(", ") + "]"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue