1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-11-30 18:44:35 +01:00

clippy warnings

This commit is contained in:
Nikolay Kim 2018-04-09 14:25:30 -07:00
parent be358db422
commit e757dc5a71
7 changed files with 29 additions and 29 deletions

View File

@ -259,11 +259,11 @@ impl ClientRequest {
impl fmt::Debug for ClientRequest {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let res = write!(f, "\nClientRequest {:?} {}:{}\n",
let res = writeln!(f, "\nClientRequest {:?} {}:{}",
self.version, self.method, self.uri);
let _ = write!(f, " headers:\n");
let _ = writeln!(f, " headers:");
for (key, val) in self.headers.iter() {
let _ = write!(f, " {:?}: {:?}\n", key, val);
let _ = writeln!(f, " {:?}: {:?}", key, val);
}
res
}
@ -671,11 +671,11 @@ fn parts<'a>(parts: &'a mut Option<ClientRequest>, err: &Option<HttpError>)
impl fmt::Debug for ClientRequestBuilder {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if let Some(ref parts) = self.request {
let res = write!(f, "\nClientRequestBuilder {:?} {}:{}\n",
parts.version, parts.method, parts.uri);
let _ = write!(f, " headers:\n");
let res = writeln!(f, "\nClientRequestBuilder {:?} {}:{}",
parts.version, parts.method, parts.uri);
let _ = writeln!(f, " headers:");
for (key, val) in parts.headers.iter() {
let _ = write!(f, " {:?}: {:?}\n", key, val);
let _ = writeln!(f, " {:?}: {:?}", key, val);
}
res
} else {

View File

@ -106,11 +106,11 @@ impl ClientResponse {
impl fmt::Debug for ClientResponse {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let res = write!(
f, "\nClientResponse {:?} {}\n", self.version(), self.status());
let _ = write!(f, " headers:\n");
let res = writeln!(
f, "\nClientResponse {:?} {}", self.version(), self.status());
let _ = writeln!(f, " headers:");
for (key, val) in self.headers().iter() {
let _ = write!(f, " {:?}: {:?}\n", key, val);
let _ = writeln!(f, " {:?}: {:?}", key, val);
}
res
}

View File

@ -105,10 +105,10 @@ impl HttpClientWriter {
// render message
{
// status line
write!(self.buffer, "{} {} {:?}\r\n",
msg.method(),
msg.uri().path_and_query().map(|u| u.as_str()).unwrap_or("/"),
msg.version())?;
writeln!(self.buffer, "{} {} {:?}\r",
msg.method(),
msg.uri().path_and_query().map(|u| u.as_str()).unwrap_or("/"),
msg.version())?;
// write headers
let mut buffer = self.buffer.get_mut();

View File

@ -555,17 +555,17 @@ impl<S> AsyncRead for HttpRequest<S> {}
impl<S> fmt::Debug for HttpRequest<S> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let res = write!(f, "\nHttpRequest {:?} {}:{}\n",
let res = writeln!(f, "\nHttpRequest {:?} {}:{}",
self.as_ref().version, self.as_ref().method, self.path_decoded());
if !self.query_string().is_empty() {
let _ = write!(f, " query: ?{:?}\n", self.query_string());
let _ = writeln!(f, " query: ?{:?}", self.query_string());
}
if !self.match_info().is_empty() {
let _ = write!(f, " params: {:?}\n", self.as_ref().params);
let _ = writeln!(f, " params: {:?}", self.as_ref().params);
}
let _ = write!(f, " headers:\n");
let _ = writeln!(f, " headers:");
for (key, val) in self.as_ref().headers.iter() {
let _ = write!(f, " {:?}: {:?}\n", key, val);
let _ = writeln!(f, " {:?}: {:?}", key, val);
}
res
}

View File

@ -241,13 +241,13 @@ impl HttpResponse {
impl fmt::Debug for HttpResponse {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let res = write!(f, "\nHttpResponse {:?} {}{}\n",
let res = writeln!(f, "\nHttpResponse {:?} {}{}",
self.get_ref().version, self.get_ref().status,
self.get_ref().reason.unwrap_or(""));
let _ = write!(f, " encoding: {:?}\n", self.get_ref().encoding);
let _ = write!(f, " headers:\n");
let _ = writeln!(f, " encoding: {:?}", self.get_ref().encoding);
let _ = writeln!(f, " headers:");
for (key, val) in self.get_ref().headers.iter() {
let _ = write!(f, " {:?}: {:?}\n", key, val);
let _ = writeln!(f, " {:?}: {:?}", key, val);
}
res
}

View File

@ -396,11 +396,11 @@ impl<S> Stream for Field<S> where S: Stream<Item=Bytes, Error=PayloadError> {
impl<S> fmt::Debug for Field<S> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let res = write!(f, "\nMultipartField: {}\n", self.ct);
let _ = write!(f, " boundary: {}\n", self.inner.borrow().boundary);
let _ = write!(f, " headers:\n");
let res = writeln!(f, "\nMultipartField: {}", self.ct);
let _ = writeln!(f, " boundary: {}", self.inner.borrow().boundary);
let _ = writeln!(f, " headers:");
for (key, val) in self.headers.iter() {
let _ = write!(f, " {:?}: {:?}\n", key, val);
let _ = writeln!(f, " {:?}: {:?}", key, val);
}
res
}

View File

@ -718,7 +718,7 @@ impl TransferEncoding {
self.buffer.extend_from_slice(b"0\r\n\r\n");
} else {
let mut buf = BytesMut::new();
write!(&mut buf, "{:X}\r\n", msg.len())
writeln!(&mut buf, "{:X}\r", msg.len())
.map_err(|e| io::Error::new(io::ErrorKind::Other, e))?;
self.buffer.reserve(buf.len() + msg.len() + 2);
self.buffer.extend(buf.into());