mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Fix a bunch of clippy lints
This commit is contained in:
parent
b1ca3d1cdf
commit
6b215f38ee
58 changed files with 281 additions and 356 deletions
|
@ -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!();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue