std: Remove format_strbuf!()

This was only ever a transitionary macro.
This commit is contained in:
Alex Crichton 2014-05-27 20:44:58 -07:00
parent 24b1ce1daf
commit 42aed6bde2
104 changed files with 754 additions and 931 deletions

View file

@ -1000,7 +1000,7 @@ impl Clean<Type> for ty::t {
ty::ty_str => String,
ty::ty_vec(mt, None) => Vector(box mt.ty.clean()),
ty::ty_vec(mt, Some(i)) => FixedVector(box mt.ty.clean(),
format_strbuf!("{}", i)),
format!("{}", i)),
ty::ty_ptr(mt) => RawPointer(mt.mutbl.clean(), box mt.ty.clean()),
ty::ty_rptr(r, mt) => BorrowedRef {
lifetime: r.clean(),
@ -1697,8 +1697,8 @@ impl ToSource for syntax::codemap::Span {
fn lit_to_str(lit: &ast::Lit) -> String {
match lit.node {
ast::LitStr(ref st, _) => st.get().to_string(),
ast::LitBinary(ref data) => format_strbuf!("{:?}", data.as_slice()),
ast::LitChar(c) => format_strbuf!("'{}'", c),
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(),
@ -1817,7 +1817,7 @@ pub struct Macro {
impl Clean<Item> for doctree::Macro {
fn clean(&self) -> Item {
Item {
name: Some(format_strbuf!("{}!", self.name.clean())),
name: Some(format!("{}!", self.name.clean())),
attrs: self.attrs.clean(),
source: self.where.clean(),
visibility: ast::Public.clean(),

View file

@ -366,7 +366,7 @@ impl fmt::Show for clean::Type {
lifetimes = if decl.lifetimes.len() == 0 {
"".to_string()
} else {
format_strbuf!("&lt;{:#}&gt;", decl.lifetimes)
format!("&lt;{:#}&gt;", decl.lifetimes)
},
args = decl.decl.inputs,
bounds = if decl.bounds.len() == 0 {
@ -375,7 +375,7 @@ impl fmt::Show for clean::Type {
let mut m = decl.bounds
.iter()
.map(|s| s.to_str().to_string());
format_strbuf!(
format!(
": {}",
m.collect::<Vec<String>>().connect(" + "))
},
@ -388,7 +388,7 @@ impl fmt::Show for clean::Type {
match decl.abi.as_slice() {
"" => " extern ".to_string(),
"\"Rust\"" => "".to_string(),
s => format_strbuf!(" extern {} ", s)
s => format!(" extern {} ", s)
},
decl.generics,
decl.decl)

View file

@ -223,7 +223,7 @@ pub fn render(w: &mut fmt::Formatter, s: &str, print_toc: bool) -> fmt::Result {
let map = used_header_map.get().unwrap();
let id = match map.borrow_mut().find_mut(&id) {
None => id,
Some(a) => { *a += 1; format_strbuf!("{}-{}", id, *a - 1) }
Some(a) => { *a += 1; format!("{}-{}", id, *a - 1) }
};
map.borrow_mut().insert(id.clone(), 1);

View file

@ -578,7 +578,7 @@ fn extern_location(e: &clean::ExternalCrate, dst: &Path) -> ExternalLocation {
if s.as_slice().ends_with("/") {
return Remote(s.to_string());
}
return Remote(format_strbuf!("{}/", s));
return Remote(format!("{}/", s));
}
_ => {}
}
@ -1187,12 +1187,12 @@ impl<'a> fmt::Show for Item<'a> {
fn item_path(item: &clean::Item) -> String {
match item.inner {
clean::ModuleItem(..) => {
format_strbuf!("{}/index.html", item.name.get_ref())
format!("{}/index.html", item.name.get_ref())
}
_ => {
format_strbuf!("{}.{}.html",
shortty(item).to_static_str(),
*item.name.get_ref())
format!("{}.{}.html",
shortty(item).to_static_str(),
*item.name.get_ref())
}
}
}

View file

@ -154,7 +154,7 @@ impl TocBuilder {
sec_number.push_str("0.");
}
let number = toc.count_entries_with_level(level);
sec_number.push_str(format_strbuf!("{}", number + 1).as_slice())
sec_number.push_str(format!("{}", number + 1).as_slice())
}
self.chain.push(TocEntry {

View file

@ -248,7 +248,7 @@ fn acquire_input(input: &str,
match matches.opt_str("r").as_ref().map(|s| s.as_slice()) {
Some("rust") => Ok(rust_input(input, matches)),
Some("json") => json_input(input),
Some(s) => Err(format_strbuf!("unknown input format: {}", s)),
Some(s) => Err(format!("unknown input format: {}", s)),
None => {
if input.ends_with(".json") {
json_input(input)
@ -356,7 +356,7 @@ fn json_input(input: &str) -> Result<Output, String> {
let mut input = match File::open(&Path::new(input)) {
Ok(f) => f,
Err(e) => {
return Err(format_strbuf!("couldn't open {}: {}", input, e))
return Err(format!("couldn't open {}: {}", input, e))
}
};
match json::from_reader(&mut input) {
@ -367,7 +367,7 @@ fn json_input(input: &str) -> Result<Output, String> {
match obj.pop(&"schema".to_string()) {
Some(json::String(version)) => {
if version.as_slice() != SCHEMA_VERSION {
return Err(format_strbuf!(
return Err(format!(
"sorry, but I only understand version {}",
SCHEMA_VERSION))
}

View file

@ -260,9 +260,9 @@ impl Collector {
pub fn add_test(&mut self, test: String, should_fail: bool, no_run: bool, should_ignore: bool) {
let name = if self.use_headers {
let s = self.current_header.as_ref().map(|s| s.as_slice()).unwrap_or("");
format_strbuf!("{}_{}", s, self.cnt)
format!("{}_{}", s, self.cnt)
} else {
format_strbuf!("{}_{}", self.names.connect("::"), self.cnt)
format!("{}_{}", self.names.connect("::"), self.cnt)
};
self.cnt += 1;
let libs = self.libs.clone();