diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-05-27 20:44:58 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-05-28 08:35:41 -0700 |
| commit | 42aed6bde2fb05a262e21334656cdf91f51744dd (patch) | |
| tree | 0b7c43f70001fe714a13f95df7e2807a8fdfb85b /src/libserialize | |
| parent | 24b1ce1daf9dbf66d04116d0549a48a7610bc614 (diff) | |
| download | rust-42aed6bde2fb05a262e21334656cdf91f51744dd.tar.gz rust-42aed6bde2fb05a262e21334656cdf91f51744dd.zip | |
std: Remove format_strbuf!()
This was only ever a transitionary macro.
Diffstat (limited to 'src/libserialize')
| -rw-r--r-- | src/libserialize/ebml.rs | 32 | ||||
| -rw-r--r-- | src/libserialize/hex.rs | 3 | ||||
| -rw-r--r-- | src/libserialize/json.rs | 14 |
3 files changed, 20 insertions, 29 deletions
diff --git a/src/libserialize/ebml.rs b/src/libserialize/ebml.rs index a127c11f509..67045476f6d 100644 --- a/src/libserialize/ebml.rs +++ b/src/libserialize/ebml.rs @@ -313,10 +313,8 @@ pub mod reader { self.pos = r_doc.end; let str = r_doc.as_str_slice(); if lbl != str { - return Err(Expected(format_strbuf!("Expected label \ - {} but found {}", - lbl, - str))); + return Err(Expected(format!("Expected label {} but \ + found {}", lbl, str))); } } } @@ -326,8 +324,8 @@ pub mod reader { fn next_doc(&mut self, exp_tag: EbmlEncoderTag) -> DecodeResult<Doc<'doc>> { debug!(". next_doc(exp_tag={})", exp_tag); if self.pos >= self.parent.end { - return Err(Expected(format_strbuf!("no more documents in \ - current node!"))); + return Err(Expected(format!("no more documents in \ + current node!"))); } let TaggedDoc { tag: r_tag, doc: r_doc } = try!(doc_at(self.parent.data, self.pos)); @@ -339,18 +337,13 @@ pub mod reader { r_doc.start, r_doc.end); if r_tag != (exp_tag as uint) { - return Err(Expected(format_strbuf!("expected EBML doc with \ - tag {} but found tag \ - {}", - exp_tag, - r_tag))); + return Err(Expected(format!("expected EBML doc with tag {} but \ + found tag {}", exp_tag, r_tag))); } if r_doc.end > self.parent.end { - return Err(Expected(format_strbuf!("invalid EBML, child \ - extends to {:#x}, parent \ - to {:#x}", - r_doc.end, - self.parent.end))); + return Err(Expected(format!("invalid EBML, child extends to \ + {:#x}, parent to {:#x}", + r_doc.end, self.parent.end))); } self.pos = r_doc.end; Ok(r_doc) @@ -582,8 +575,7 @@ pub mod reader { 0 => f(this, false), 1 => f(this, true), _ => { - Err(Expected(format_strbuf!("Expected None or \ - Some"))) + Err(Expected(format!("Expected None or Some"))) } } }) @@ -664,7 +656,7 @@ pub mod writer { _ => Err(io::IoError { kind: io::OtherIoError, desc: "int too big", - detail: Some(format_strbuf!("{}", n)) + detail: Some(format!("{}", n)) }) } } @@ -677,7 +669,7 @@ pub mod writer { Err(io::IoError { kind: io::OtherIoError, desc: "int too big", - detail: Some(format_strbuf!("{}", n)) + detail: Some(format!("{}", n)) }) } diff --git a/src/libserialize/hex.rs b/src/libserialize/hex.rs index 373bff8b0cc..8ae3336c342 100644 --- a/src/libserialize/hex.rs +++ b/src/libserialize/hex.rs @@ -174,8 +174,7 @@ mod tests { #[test] pub fn test_to_hex_all_bytes() { for i in range(0, 256) { - assert_eq!([i as u8].to_hex(), - format_strbuf!("{:02x}", i as uint)); + assert_eq!([i as u8].to_hex(), format!("{:02x}", i as uint)); } } diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs index 08ac66959bc..09ba46bf0c7 100644 --- a/src/libserialize/json.rs +++ b/src/libserialize/json.rs @@ -1819,7 +1819,7 @@ macro_rules! expect( match $e { Null => Ok(()), other => Err(ExpectedError("Null".to_string(), - format_strbuf!("{}", other))) + format!("{}", other))) } }); ($e:expr, $t:ident) => ({ @@ -1827,7 +1827,7 @@ macro_rules! expect( $t(v) => Ok(v), other => { Err(ExpectedError(stringify!($t).to_string(), - format_strbuf!("{}", other))) + format!("{}", other))) } } }) @@ -1869,7 +1869,7 @@ impl ::Decoder<DecoderError> for Decoder { }, value => { Err(ExpectedError("Number".to_string(), - format_strbuf!("{}", value))) + format!("{}", value))) } } } @@ -1887,7 +1887,7 @@ impl ::Decoder<DecoderError> for Decoder { } } Err(ExpectedError("single character string".to_string(), - format_strbuf!("{}", s))) + format!("{}", s))) } fn read_str(&mut self) -> DecodeResult<String> { @@ -1914,7 +1914,7 @@ impl ::Decoder<DecoderError> for Decoder { Some(String(s)) => s, Some(val) => { return Err(ExpectedError("String".to_string(), - format_strbuf!("{}", val))) + format!("{}", val))) } None => { return Err(MissingFieldError("variant".to_string())) @@ -1928,7 +1928,7 @@ impl ::Decoder<DecoderError> for Decoder { }, Some(val) => { return Err(ExpectedError("List".to_string(), - format_strbuf!("{}", val))) + format!("{}", val))) } None => { return Err(MissingFieldError("fields".to_string())) @@ -1938,7 +1938,7 @@ impl ::Decoder<DecoderError> for Decoder { } json => { return Err(ExpectedError("String or Object".to_string(), - format_strbuf!("{}", json))) + format!("{}", json))) } }; let idx = match names.iter() |
