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

Don't ignore errors in std::fmt::Debug implementations (#506)

This commit is contained in:
Maciej Piechotka 2018-09-11 13:57:55 +02:00 committed by Douman
parent cdb57b840e
commit 003b05b095
4 changed files with 26 additions and 26 deletions

View File

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

View File

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

View File

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

View File

@ -441,13 +441,13 @@ where
impl<S> fmt::Debug for Field<S> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let res = writeln!(f, "\nMultipartField: {}", self.ct);
let _ = writeln!(f, " boundary: {}", self.inner.borrow().boundary);
let _ = writeln!(f, " headers:");
writeln!(f, "\nMultipartField: {}", self.ct)?;
writeln!(f, " boundary: {}", self.inner.borrow().boundary)?;
writeln!(f, " headers:")?;
for (key, val) in self.headers.iter() {
let _ = writeln!(f, " {:?}: {:?}", key, val);
writeln!(f, " {:?}: {:?}", key, val)?;
}
res
Ok(())
}
}