Fix obsolete format traits.

They are to be removed from the language in the next rust upgrade.
This commit is contained in:
Ms2ger 2015-01-01 21:49:19 +01:00
parent 141b5d038f
commit b51e83819d
35 changed files with 63 additions and 63 deletions

View file

@ -16,7 +16,7 @@ pub trait JsonPacketStream {
impl JsonPacketStream for TcpStream {
fn write_json_packet<'a, T: Encodable<json::Encoder<'a>,IoError>>(&mut self, obj: &T) {
let s = json::encode(obj).replace("__type__", "type");
println!("<- {:s}", s);
println!("<- {}", s);
self.write_str(s.len().to_string().as_slice()).unwrap();
self.write_u8(':' as u8).unwrap();
self.write_str(s.as_slice()).unwrap();
@ -35,7 +35,7 @@ impl JsonPacketStream for TcpStream {
let packet_len = num::from_str_radix(packet_len_str.as_slice(), 10).unwrap();
let packet_buf = self.read_exact(packet_len).unwrap();
let packet = String::from_utf8(packet_buf).unwrap();
println!("{:s}", packet);
println!("{}", packet);
return Ok(json::from_str(packet.as_slice()).unwrap())
},
Err(ref e) if e.kind == EndOfFile =>