std: Remove i18n/l10n from format!

* The select/plural methods from format strings are removed
* The # character no longer needs to be escaped
* The \-based escapes have been removed
* '{{' is now an escape for '{'
* '}}' is now an escape for '}'

Closes #14810
[breaking-change]
This commit is contained in:
Alex Crichton
2014-05-28 09:24:28 -07:00
parent f9260d41d6
commit cac7a2053a
57 changed files with 736 additions and 1087 deletions

View File

@@ -348,8 +348,7 @@ impl fmt::Show for clean::Type {
clean::Self(..) => f.write("Self".as_bytes()),
clean::Primitive(prim) => primitive_link(f, prim, prim.to_str()),
clean::Closure(ref decl, ref region) => {
write!(f, "{style}{lifetimes}|{args}|{bounds}\
{arrow, select, yes{ -> {ret}} other{}}",
write!(f, "{style}{lifetimes}|{args}|{bounds}{arrow}",
style = FnStyleSpace(decl.fn_style),
lifetimes = if decl.lifetimes.len() == 0 {
"".to_string()
@@ -358,10 +357,9 @@ impl fmt::Show for clean::Type {
},
args = decl.decl.inputs,
arrow = match decl.decl.output {
clean::Primitive(clean::Nil) => "no",
_ => "yes",
clean::Primitive(clean::Nil) => "".to_string(),
_ => format!(" -> {}", decl.decl.output),
},
ret = decl.decl.output,
bounds = {
let mut ret = String::new();
match *region {
@@ -389,8 +387,7 @@ impl fmt::Show for clean::Type {
})
}
clean::Proc(ref decl) => {
write!(f, "{style}{lifetimes}proc({args}){bounds}\
{arrow, select, yes{ -> {ret}} other{}}",
write!(f, "{style}{lifetimes}proc({args}){bounds}{arrow}",
style = FnStyleSpace(decl.fn_style),
lifetimes = if decl.lifetimes.len() == 0 {
"".to_string()
@@ -409,10 +406,9 @@ impl fmt::Show for clean::Type {
m.collect::<Vec<String>>().connect(" + "))
},
arrow = match decl.decl.output {
clean::Primitive(clean::Nil) => "no",
_ => "yes",
},
ret = decl.decl.output)
clean::Primitive(clean::Nil) => "".to_string(),
_ => format!(" -&gt; {}", decl.decl.output)
})
}
clean::BareFunction(ref decl) => {
write!(f, "{}{}fn{}{}",
@@ -468,13 +464,12 @@ impl fmt::Show for clean::Arguments {
impl fmt::Show for clean::FnDecl {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "({args}){arrow, select, yes{ -&gt; {ret}} other{}}",
write!(f, "({args}){arrow}",
args = self.inputs,
arrow = match self.output {
clean::Primitive(clean::Nil) => "no",
_ => "yes"
},
ret = self.output)
clean::Primitive(clean::Nil) => "".to_string(),
_ => format!(" -&gt; {}", self.output),
})
}
}
@@ -502,14 +497,12 @@ impl<'a> fmt::Show for Method<'a> {
}
args.push_str(format!("{}", input.type_).as_slice());
}
write!(f,
"({args}){arrow, select, yes{ -&gt; {ret}} other{}}",
write!(f, "({args}){arrow}",
args = args,
arrow = match d.output {
clean::Primitive(clean::Nil) => "no",
_ => "yes"
},
ret = d.output)
clean::Primitive(clean::Nil) => "".to_string(),
_ => format!(" -&gt; {}", d.output),
})
}
}
@@ -545,14 +538,14 @@ impl fmt::Show for clean::ViewPath {
write!(f, "use {}::*;", *src)
}
clean::ImportList(ref src, ref names) => {
try!(write!(f, "use {}::\\{", *src));
try!(write!(f, "use {}::{{", *src));
for (i, n) in names.iter().enumerate() {
if i > 0 {
try!(write!(f, ", "));
}
try!(write!(f, "{}", *n));
}
write!(f, "\\};")
write!(f, "}};")
}
}
}