std: Remove format_strbuf!()
This was only ever a transitionary macro.
This commit is contained in:
parent
24b1ce1daf
commit
42aed6bde2
104 changed files with 754 additions and 931 deletions
|
|
@ -74,8 +74,8 @@ fn main() {
|
|||
let b = bottom_up_tree(&arena, -i, depth);
|
||||
chk += item_check(a) + item_check(b);
|
||||
}
|
||||
format_strbuf!("{}\t trees of depth {}\t check: {}",
|
||||
iterations * 2, depth, chk)
|
||||
format!("{}\t trees of depth {}\t check: {}",
|
||||
iterations * 2, depth, chk)
|
||||
})
|
||||
}).collect::<Vec<Future<String>>>();
|
||||
|
||||
|
|
|
|||
|
|
@ -134,9 +134,7 @@ fn creature(
|
|||
}
|
||||
}
|
||||
// log creatures met and evil clones of self
|
||||
let report = format_strbuf!("{}{}",
|
||||
creatures_met,
|
||||
Number(evil_clones_met));
|
||||
let report = format!("{}{}", creatures_met, Number(evil_clones_met));
|
||||
to_rendezvous_log.send(report);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -129,11 +129,11 @@ fn make_sequence_processor(sz: uint,
|
|||
let buffer = match sz {
|
||||
1u => { sort_and_fmt(&freqs, total) }
|
||||
2u => { sort_and_fmt(&freqs, total) }
|
||||
3u => { format_strbuf!("{}\t{}", find(&freqs, "GGT".to_string()), "GGT") }
|
||||
4u => { format_strbuf!("{}\t{}", find(&freqs, "GGTA".to_string()), "GGTA") }
|
||||
6u => { format_strbuf!("{}\t{}", find(&freqs, "GGTATT".to_string()), "GGTATT") }
|
||||
12u => { format_strbuf!("{}\t{}", find(&freqs, "GGTATTTTAATT".to_string()), "GGTATTTTAATT") }
|
||||
18u => { format_strbuf!("{}\t{}", find(&freqs, "GGTATTTTAATTTATAGT".to_string()),
|
||||
3u => { format!("{}\t{}", find(&freqs, "GGT".to_string()), "GGT") }
|
||||
4u => { format!("{}\t{}", find(&freqs, "GGTA".to_string()), "GGTA") }
|
||||
6u => { format!("{}\t{}", find(&freqs, "GGTATT".to_string()), "GGTATT") }
|
||||
12u => { format!("{}\t{}", find(&freqs, "GGTATTTTAATT".to_string()), "GGTATTTTAATT") }
|
||||
18u => { format!("{}\t{}", find(&freqs, "GGTATTTTAATTTATAGT".to_string()),
|
||||
"GGTATTTTAATTTATAGT") }
|
||||
_ => { "".to_string() }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@
|
|||
// Regression test for #13428
|
||||
|
||||
fn foo() -> String { //~ ERROR not all control paths return a value
|
||||
format_strbuf!("Hello {}",
|
||||
"world")
|
||||
format!("Hello {}",
|
||||
"world")
|
||||
// Put the trailing semicolon on its own line to test that the
|
||||
// note message gets the offending semicolon exactly
|
||||
; //~ NOTE consider removing this semicolon
|
||||
|
|
|
|||
|
|
@ -15,5 +15,5 @@
|
|||
fn main() {
|
||||
let mut a = 1;
|
||||
if 1 == 1 { a = 2; }
|
||||
fail!(format_strbuf!("woooo{}", "o"));
|
||||
fail!(format!("woooo{}", "o"));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,10 +20,10 @@ fn main() {
|
|||
macerate((*tasties).clone());
|
||||
});
|
||||
result(carrots, |food| {
|
||||
let mush = format_strbuf!("{}{}", food, cheese);
|
||||
let mush = format!("{}{}", food, cheese);
|
||||
let cheese = cheese.clone();
|
||||
let f: || = || {
|
||||
let _chew = format_strbuf!("{}{}", mush, cheese);
|
||||
let _chew = format!("{}{}", mush, cheese);
|
||||
fail!("so yummy")
|
||||
};
|
||||
f();
|
||||
|
|
|
|||
|
|
@ -16,13 +16,13 @@ trait Foo {
|
|||
|
||||
impl<T:Foo> Foo for @T {
|
||||
fn foo(&self) -> String {
|
||||
format_strbuf!("@{}", (**self).foo())
|
||||
format!("@{}", (**self).foo())
|
||||
}
|
||||
}
|
||||
|
||||
impl Foo for uint {
|
||||
fn foo(&self) -> String {
|
||||
format_strbuf!("{}", *self)
|
||||
format!("{}", *self)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,15 +19,15 @@ fn hello<S:Speak>(s:&S) -> String{
|
|||
|
||||
impl Speak for int {
|
||||
fn say(&self, s:&str) -> String {
|
||||
format_strbuf!("{}: {}", s, *self)
|
||||
format!("{}: {}", s, *self)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Speak> Speak for Option<T> {
|
||||
fn say(&self, s:&str) -> String {
|
||||
match *self {
|
||||
None => format_strbuf!("{} - none", s),
|
||||
Some(ref x) => { format_strbuf!("something!{}", x.say(s)) }
|
||||
None => format!("{} - none", s),
|
||||
Some(ref x) => { format!("something!{}", x.say(s)) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,15 +50,15 @@ pub fn main() {
|
|||
|
||||
let greeting = "Hello ".to_string();
|
||||
call_it(proc(s) {
|
||||
format_strbuf!("{}{}", greeting, s)
|
||||
format!("{}{}", greeting, s)
|
||||
});
|
||||
|
||||
let greeting = "Goodbye ".to_string();
|
||||
call_it(proc(s) format_strbuf!("{}{}", greeting, s));
|
||||
call_it(proc(s) format!("{}{}", greeting, s));
|
||||
|
||||
let greeting = "How's life, ".to_string();
|
||||
call_it(proc(s: String) -> String {
|
||||
format_strbuf!("{}{}", greeting, s)
|
||||
format!("{}{}", greeting, s)
|
||||
});
|
||||
|
||||
// Closures
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ fn add_interface(_store: int, managed_ip: String, data: json::Json) -> (String,
|
|||
let name = lookup((*interface).clone(),
|
||||
"ifDescr".to_string(),
|
||||
"".to_string());
|
||||
let label = format_strbuf!("{}-{}", managed_ip, name);
|
||||
let label = format!("{}-{}", managed_ip, name);
|
||||
|
||||
(label, bool_value(false))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
extern crate debug;
|
||||
|
||||
fn assert_repr_eq<T>(obj : T, expected : String) {
|
||||
assert_eq!(expected, format_strbuf!("{:?}", obj));
|
||||
assert_eq!(expected, format!("{:?}", obj));
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
|
|
|
|||
|
|
@ -17,19 +17,19 @@ enum foo {
|
|||
}
|
||||
|
||||
fn check_log<T>(exp: String, v: T) {
|
||||
assert_eq!(exp, format_strbuf!("{:?}", v));
|
||||
assert_eq!(exp, format!("{:?}", v));
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let mut x = Some(a(22u));
|
||||
let exp = "Some(a(22u))".to_string();
|
||||
let act = format_strbuf!("{:?}", x);
|
||||
let act = format!("{:?}", x);
|
||||
assert_eq!(act, exp);
|
||||
check_log(exp, x);
|
||||
|
||||
x = None;
|
||||
let exp = "None".to_string();
|
||||
let act = format_strbuf!("{:?}", x);
|
||||
let act = format!("{:?}", x);
|
||||
assert_eq!(act, exp);
|
||||
check_log(exp, x);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ enum bar {
|
|||
}
|
||||
|
||||
pub fn main() {
|
||||
assert_eq!("a(22u)".to_string(), format_strbuf!("{:?}", a(22u)));
|
||||
assert_eq!("c".to_string(), format_strbuf!("{:?}", c));
|
||||
assert_eq!("d".to_string(), format_strbuf!("{:?}", d));
|
||||
assert_eq!("a(22u)".to_string(), format!("{:?}", a(22u)));
|
||||
assert_eq!("c".to_string(), format!("{:?}", c));
|
||||
assert_eq!("d".to_string(), format!("{:?}", d));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ fn f2(ref_string: &str) -> String {
|
|||
match ref_string {
|
||||
"a" => "found a".to_string(),
|
||||
"b" => "found b".to_string(),
|
||||
s => format_strbuf!("not found ({})", s)
|
||||
s => format!("not found ({})", s)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -38,7 +38,7 @@ fn g2(ref_1: &str, ref_2: &str) -> String {
|
|||
match (ref_1, ref_2) {
|
||||
("a", "b") => "found a,b".to_string(),
|
||||
("b", "c") => "found b,c".to_string(),
|
||||
(s1, s2) => format_strbuf!("not found ({}, {})", s1, s2)
|
||||
(s1, s2) => format!("not found ({}, {})", s1, s2)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,8 +45,8 @@ pub fn main() {
|
|||
assert_eq!(transform(Some(10)), Some("11".to_string()));
|
||||
assert_eq!(transform(None), None);
|
||||
assert!((vec!("hi".to_string()))
|
||||
.bind(|x| vec!(x.clone(), format_strbuf!("{}!", x)) )
|
||||
.bind(|x| vec!(x.clone(), format_strbuf!("{}?", x)) ) ==
|
||||
.bind(|x| vec!(x.clone(), format!("{}!", x)) )
|
||||
.bind(|x| vec!(x.clone(), format!("{}?", x)) ) ==
|
||||
vec!("hi".to_string(),
|
||||
"hi?".to_string(),
|
||||
"hi!".to_string(),
|
||||
|
|
|
|||
|
|
@ -36,8 +36,7 @@ fn main() {
|
|||
let blah = "\u03c0\u042f\u97f3\u00e6\u221e";
|
||||
|
||||
let child_name = "child";
|
||||
let child_dir = format_strbuf!("process-spawn-with-unicode-params-{}",
|
||||
blah);
|
||||
let child_dir = format!("process-spawn-with-unicode-params-{}", blah);
|
||||
|
||||
// parameters sent to child / expected to be received from parent
|
||||
let arg = blah;
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ pub fn main() {
|
|||
assert_eq!(map.find(&Owned("def".to_string())), Some(&d));
|
||||
|
||||
assert!(map.pop(&Slice("foo")).is_some());
|
||||
assert_eq!(map.move_iter().map(|(k, v)| format_strbuf!("{}{}", k, v))
|
||||
assert_eq!(map.move_iter().map(|(k, v)| format!("{}{}", k, v))
|
||||
.collect::<Vec<String>>()
|
||||
.concat(),
|
||||
"abc50bcd51cde52def53".to_string());
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
pub fn main() {
|
||||
let a: String = "hello".to_string();
|
||||
let b: String = "world".to_string();
|
||||
let s: String = format_strbuf!("{}{}", a, b);
|
||||
let s: String = format!("{}{}", a, b);
|
||||
println!("{}", s.clone());
|
||||
assert_eq!(s.as_slice()[9], 'd' as u8);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ pub fn main() {
|
|||
while i > 0 {
|
||||
println!("{}", a.len());
|
||||
assert_eq!(a.len(), expected_len);
|
||||
a = format_strbuf!("{}{}", a, a);
|
||||
a = format!("{}{}", a, a);
|
||||
i -= 1;
|
||||
expected_len *= 2u;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ impl<T:to_str> to_str for Option<T> {
|
|||
fn to_str_(&self) -> String {
|
||||
match *self {
|
||||
None => { "none".to_string() }
|
||||
Some(ref t) => format_strbuf!("some({})", t.to_str_()),
|
||||
Some(ref t) => format!("some({})", t.to_str_()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -46,10 +46,7 @@ impl to_str for Tree {
|
|||
let this = t.borrow();
|
||||
let (l, r) = (this.left, this.right);
|
||||
let val = &this.val;
|
||||
format_strbuf!("[{}, {}, {}]",
|
||||
val.to_str_(),
|
||||
l.to_str_(),
|
||||
r.to_str_())
|
||||
format!("[{}, {}, {}]", val.to_str_(), l.to_str_(), r.to_str_())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,11 +20,11 @@ impl to_str for int {
|
|||
|
||||
impl<T:to_str> to_str for Vec<T> {
|
||||
fn to_string(&self) -> String {
|
||||
format_strbuf!("[{}]",
|
||||
self.iter()
|
||||
.map(|e| e.to_string())
|
||||
.collect::<Vec<String>>()
|
||||
.connect(", "))
|
||||
format!("[{}]",
|
||||
self.iter()
|
||||
.map(|e| e.to_string())
|
||||
.collect::<Vec<String>>()
|
||||
.connect(", "))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -33,7 +33,7 @@ pub fn main() {
|
|||
assert!((vec!(2, 3, 4)).to_string() == "[2, 3, 4]".to_string());
|
||||
|
||||
fn indirect<T:to_str>(x: T) -> String {
|
||||
format_strbuf!("{}!", x.to_string())
|
||||
format!("{}!", x.to_string())
|
||||
}
|
||||
assert!(indirect(vec!(10, 20)) == "[10, 20]!".to_string());
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
trait Foo {
|
||||
fn bar(&self) -> String {
|
||||
format_strbuf!("test")
|
||||
format!("test")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue