From 46ab9eb436ecf1a1f4bd5a5e6088e75fd5f7e261 Mon Sep 17 00:00:00 2001 From: Michael Gehring Date: Wed, 9 Jul 2014 15:35:54 +0200 Subject: ToStr::to_str -> ToString::to_string --- src/serialization.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/serialization.rs') diff --git a/src/serialization.rs b/src/serialization.rs index 7c11fb5..deec85c 100644 --- a/src/serialization.rs +++ b/src/serialization.rs @@ -187,10 +187,10 @@ impl serialize::Encoder for Encoder { self.emit_value(Float(v)) } fn emit_char(&mut self, v: char) -> Result<(), Error> { - self.emit_str(v.to_str().as_slice()) + self.emit_str(v.to_string().as_slice()) } fn emit_str(&mut self, v: &str) -> Result<(), Error> { - self.emit_value(String(v.to_str())) + self.emit_value(String(v.to_string())) } fn emit_enum(&mut self, _name: &str, f: |&mut Encoder| -> Result<(), Error>) -> Result<(), Error> { @@ -245,7 +245,7 @@ impl serialize::Encoder for Encoder { f: |&mut Encoder| -> Result<(), Error>) -> Result<(), Error> { - let old = mem::replace(&mut self.state, NextKey(f_name.to_str())); + let old = mem::replace(&mut self.state, NextKey(f_name.to_string())); try!(f(self)); if self.state != Start { println!("{}", self.state); @@ -762,7 +762,7 @@ mod tests { macro_rules! map( ($($k:ident: $v:expr),*) => ({ let mut _m = HashMap::new(); - $(_m.insert(stringify!($k).to_str(), $v);)* + $(_m.insert(stringify!($k).to_string(), $v);)* _m }) ) @@ -907,7 +907,7 @@ mod tests { foo: Integer(10), bar: Integer(4) }), - set: Array(vec![String("a".to_str())]) + set: Array(vec![String("a".to_string())]) } ); assert_eq!(v, decode!(Table(encode!(v)))); @@ -962,7 +962,7 @@ mod tests { match a { Ok(..) => fail!("should not have decoded"), Err(e) => { - assert_eq!(e.to_str().as_slice(), + assert_eq!(e.to_string().as_slice(), "expected a value of type `integer`, but \ found a value of type `float` for the key `bar`"); } @@ -980,7 +980,7 @@ mod tests { match a { Ok(..) => fail!("should not have decoded"), Err(e) => { - assert_eq!(e.to_str().as_slice(), + assert_eq!(e.to_string().as_slice(), "expected a value of type `integer` for the key `bar`"); } } -- cgit v1.2.3