mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +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
|
@ -340,9 +340,8 @@ impl NetworkEventActor {
|
|||
// TODO: Send the correct values for all these fields.
|
||||
let hSizeOption = self.response.headers.as_ref().map(|headers| headers.len() as u32);
|
||||
let hSize = hSizeOption.unwrap_or(0);
|
||||
let (status_code, status_message) =
|
||||
self.response.status.as_ref().map(|&RawStatus(ref code, ref text)| (*code, text.clone().into_owned())).
|
||||
unwrap_or((0, "".to_owned()));
|
||||
let (status_code, status_message) = self.response.status.as_ref().
|
||||
map_or((0, "".to_owned()), |&RawStatus(ref code, ref text)| (*code, text.clone().into_owned()));
|
||||
// TODO: Send the correct values for remoteAddress and remotePort and http_version.
|
||||
ResponseStartMsg {
|
||||
httpVersion: "HTTP/1.1".to_owned(),
|
||||
|
|
|
@ -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