Fix a bunch of clippy lints

This commit is contained in:
Johannes Linke 2016-01-02 16:51:01 +01:00
parent b1ca3d1cdf
commit 6b215f38ee
58 changed files with 281 additions and 356 deletions

View file

@ -14,18 +14,18 @@ use std::io::{Read, Write};
use std::net::TcpStream;
pub trait JsonPacketStream {
fn write_json_packet<'a, T: Encodable>(&mut self, obj: &T);
fn write_json_packet<T: Encodable>(&mut self, obj: &T);
fn read_json_packet(&mut self) -> Result<Option<Json>, String>;
}
impl JsonPacketStream for TcpStream {
fn write_json_packet<'a, T: Encodable>(&mut self, obj: &T) {
fn write_json_packet<T: Encodable>(&mut self, obj: &T) {
let s = json::encode(obj).unwrap().replace("__type__", "type");
println!("<- {}", s);
write!(self, "{}:{}", s.len(), s).unwrap();
}
fn read_json_packet<'a>(&mut self) -> Result<Option<Json>, String> {
fn read_json_packet(&mut self) -> Result<Option<Json>, String> {
// https://wiki.mozilla.org/Remote_Debugging_Protocol_Stream_Transport
// In short, each JSON packet is [ascii length]:[JSON data of given length]
let mut buffer = vec!();