libstd: Remove ~str from all libstd modules except fmt and str.
This commit is contained in:
parent
e402e75f4e
commit
36195eb91f
204 changed files with 2102 additions and 1496 deletions
|
|
@ -184,12 +184,12 @@ fn path(w: &mut fmt::Formatter, path: &clean::Path, print_all: bool,
|
|||
for lifetime in last.lifetimes.iter() {
|
||||
if counter > 0 { generics.push_str(", "); }
|
||||
counter += 1;
|
||||
generics.push_str(format!("{}", *lifetime));
|
||||
generics.push_str(format!("{}", *lifetime).as_slice());
|
||||
}
|
||||
for ty in last.types.iter() {
|
||||
if counter > 0 { generics.push_str(", "); }
|
||||
counter += 1;
|
||||
generics.push_str(format!("{}", *ty));
|
||||
generics.push_str(format!("{}", *ty).as_slice());
|
||||
}
|
||||
generics.push_str(">");
|
||||
}
|
||||
|
|
@ -323,18 +323,22 @@ impl fmt::Show for clean::Type {
|
|||
{arrow, select, yes{ -> {ret}} other{}}",
|
||||
style = FnStyleSpace(decl.fn_style),
|
||||
lifetimes = if decl.lifetimes.len() == 0 {
|
||||
"".to_owned()
|
||||
"".to_strbuf()
|
||||
} else {
|
||||
format!("<{:#}>", decl.lifetimes)
|
||||
},
|
||||
args = decl.decl.inputs,
|
||||
arrow = match decl.decl.output { clean::Unit => "no", _ => "yes" },
|
||||
arrow = match decl.decl.output {
|
||||
clean::Unit => "no",
|
||||
_ => "yes",
|
||||
},
|
||||
ret = decl.decl.output,
|
||||
bounds = {
|
||||
let mut ret = StrBuf::new();
|
||||
match *region {
|
||||
Some(ref lt) => {
|
||||
ret.push_str(format!(": {}", *lt));
|
||||
ret.push_str(format!(": {}",
|
||||
*lt).as_slice());
|
||||
}
|
||||
None => {}
|
||||
}
|
||||
|
|
@ -347,7 +351,8 @@ impl fmt::Show for clean::Type {
|
|||
} else {
|
||||
ret.push_str(" + ");
|
||||
}
|
||||
ret.push_str(format!("{}", *t));
|
||||
ret.push_str(format!("{}",
|
||||
*t).as_slice());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -416,7 +421,10 @@ impl fmt::Show for clean::Type {
|
|||
}, **t)
|
||||
}
|
||||
clean::BorrowedRef{ lifetime: ref l, mutability, type_: ref ty} => {
|
||||
let lt = match *l { Some(ref l) => format!("{} ", *l), _ => "".to_owned() };
|
||||
let lt = match *l {
|
||||
Some(ref l) => format!("{} ", *l),
|
||||
_ => "".to_strbuf(),
|
||||
};
|
||||
write!(f, "&{}{}{}",
|
||||
lt,
|
||||
match mutability {
|
||||
|
|
@ -460,10 +468,10 @@ impl<'a> fmt::Show for Method<'a> {
|
|||
clean::SelfValue => args.push_str("self"),
|
||||
clean::SelfOwned => args.push_str("~self"),
|
||||
clean::SelfBorrowed(Some(ref lt), clean::Immutable) => {
|
||||
args.push_str(format!("&{} self", *lt));
|
||||
args.push_str(format!("&{} self", *lt).as_slice());
|
||||
}
|
||||
clean::SelfBorrowed(Some(ref lt), clean::Mutable) => {
|
||||
args.push_str(format!("&{} mut self", *lt));
|
||||
args.push_str(format!("&{} mut self", *lt).as_slice());
|
||||
}
|
||||
clean::SelfBorrowed(None, clean::Mutable) => {
|
||||
args.push_str("&mut self");
|
||||
|
|
@ -475,9 +483,9 @@ impl<'a> fmt::Show for Method<'a> {
|
|||
for (i, input) in d.inputs.values.iter().enumerate() {
|
||||
if i > 0 || args.len() > 0 { args.push_str(", "); }
|
||||
if input.name.len() > 0 {
|
||||
args.push_str(format!("{}: ", input.name));
|
||||
args.push_str(format!("{}: ", input.name).as_slice());
|
||||
}
|
||||
args.push_str(format!("{}", input.type_));
|
||||
args.push_str(format!("{}", input.type_).as_slice());
|
||||
}
|
||||
write!(f,
|
||||
"({args}){arrow, select, yes{ -> {ret}} other{}}",
|
||||
|
|
|
|||
|
|
@ -407,8 +407,11 @@ pub fn run(mut krate: clean::Crate, dst: Path) -> io::IoResult<()> {
|
|||
if path.exists() {
|
||||
for line in BufferedReader::new(File::open(path)).lines() {
|
||||
let line = try!(line);
|
||||
if !line.starts_with(key) { continue }
|
||||
if line.starts_with(format!("{}['{}']", key, krate)) {
|
||||
if !line.as_slice().starts_with(key) {
|
||||
continue
|
||||
}
|
||||
if line.as_slice().starts_with(
|
||||
format!("{}['{}']", key, krate).as_slice()) {
|
||||
continue
|
||||
}
|
||||
ret.push(line.to_strbuf());
|
||||
|
|
@ -646,7 +649,7 @@ impl<'a> SourceCollector<'a> {
|
|||
|
||||
let title = format!("{} -- source", cur.filename_display());
|
||||
let page = layout::Page {
|
||||
title: title,
|
||||
title: title.as_slice(),
|
||||
ty: "source",
|
||||
root_path: root_path.as_slice(),
|
||||
};
|
||||
|
|
@ -1344,7 +1347,7 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
|
|||
parents.push_str(": ");
|
||||
for (i, p) in t.parents.iter().enumerate() {
|
||||
if i > 0 { parents.push_str(" + "); }
|
||||
parents.push_str(format!("{}", *p));
|
||||
parents.push_str(format!("{}", *p).as_slice());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ pub fn opts() -> Vec<getopts::OptGroup> {
|
|||
|
||||
pub fn usage(argv0: &str) {
|
||||
println!("{}",
|
||||
getopts::usage(format!("{} [options] <input>", argv0),
|
||||
getopts::usage(format!("{} [options] <input>", argv0).as_slice(),
|
||||
opts().as_slice()));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ pub fn render(input: &str, mut output: Path, matches: &getopts::Matches) -> int
|
|||
let mut css = StrBuf::new();
|
||||
for name in matches.opt_strs("markdown-css").iter() {
|
||||
let s = format!("<link rel=\"stylesheet\" type=\"text/css\" href=\"{}\">\n", name);
|
||||
css.push_str(s)
|
||||
css.push_str(s.as_slice())
|
||||
}
|
||||
|
||||
let input_str = load_or_return!(input, 1, 2);
|
||||
|
|
|
|||
|
|
@ -213,7 +213,8 @@ fn maketest(s: &str, cratename: &str, loose_feature_gating: bool) -> StrBuf {
|
|||
|
||||
if !s.contains("extern crate") {
|
||||
if s.contains(cratename) {
|
||||
prog.push_str(format!("extern crate {};\n", cratename));
|
||||
prog.push_str(format!("extern crate {};\n",
|
||||
cratename).as_slice());
|
||||
}
|
||||
}
|
||||
if s.contains("fn main") {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue