mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-28 01:32:57 +01:00
Don't ignore errors in std::fmt::Debug implementations (#506)
This commit is contained in:
parent
cdb57b840e
commit
003b05b095
@ -254,16 +254,16 @@ impl ClientRequest {
|
|||||||
|
|
||||||
impl fmt::Debug for ClientRequest {
|
impl fmt::Debug for ClientRequest {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
let res = writeln!(
|
writeln!(
|
||||||
f,
|
f,
|
||||||
"\nClientRequest {:?} {}:{}",
|
"\nClientRequest {:?} {}:{}",
|
||||||
self.version, self.method, self.uri
|
self.version, self.method, self.uri
|
||||||
);
|
)?;
|
||||||
let _ = writeln!(f, " headers:");
|
writeln!(f, " headers:")?;
|
||||||
for (key, val) in self.headers.iter() {
|
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 {
|
impl fmt::Debug for ClientRequestBuilder {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
if let Some(ref parts) = self.request {
|
if let Some(ref parts) = self.request {
|
||||||
let res = writeln!(
|
writeln!(
|
||||||
f,
|
f,
|
||||||
"\nClientRequestBuilder {:?} {}:{}",
|
"\nClientRequestBuilder {:?} {}:{}",
|
||||||
parts.version, parts.method, parts.uri
|
parts.version, parts.method, parts.uri
|
||||||
);
|
)?;
|
||||||
let _ = writeln!(f, " headers:");
|
writeln!(f, " headers:")?;
|
||||||
for (key, val) in parts.headers.iter() {
|
for (key, val) in parts.headers.iter() {
|
||||||
let _ = writeln!(f, " {:?}: {:?}", key, val);
|
writeln!(f, " {:?}: {:?}", key, val)?;
|
||||||
}
|
}
|
||||||
res
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
write!(f, "ClientRequestBuilder(Consumed)")
|
write!(f, "ClientRequestBuilder(Consumed)")
|
||||||
}
|
}
|
||||||
|
@ -95,12 +95,12 @@ impl ClientResponse {
|
|||||||
|
|
||||||
impl fmt::Debug for ClientResponse {
|
impl fmt::Debug for ClientResponse {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
let res = writeln!(f, "\nClientResponse {:?} {}", self.version(), self.status());
|
writeln!(f, "\nClientResponse {:?} {}", self.version(), self.status())?;
|
||||||
let _ = writeln!(f, " headers:");
|
writeln!(f, " headers:")?;
|
||||||
for (key, val) in self.headers().iter() {
|
for (key, val) in self.headers().iter() {
|
||||||
let _ = writeln!(f, " {:?}: {:?}", key, val);
|
writeln!(f, " {:?}: {:?}", key, val)?;
|
||||||
}
|
}
|
||||||
res
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,24 +354,24 @@ impl<S> FromRequest<S> for HttpRequest<S> {
|
|||||||
|
|
||||||
impl<S> fmt::Debug for HttpRequest<S> {
|
impl<S> fmt::Debug for HttpRequest<S> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
let res = writeln!(
|
writeln!(
|
||||||
f,
|
f,
|
||||||
"\nHttpRequest {:?} {}:{}",
|
"\nHttpRequest {:?} {}:{}",
|
||||||
self.version(),
|
self.version(),
|
||||||
self.method(),
|
self.method(),
|
||||||
self.path()
|
self.path()
|
||||||
);
|
)?;
|
||||||
if !self.query_string().is_empty() {
|
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() {
|
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() {
|
for (key, val) in self.headers().iter() {
|
||||||
let _ = writeln!(f, " {:?}: {:?}", key, val);
|
writeln!(f, " {:?}: {:?}", key, val)?;
|
||||||
}
|
}
|
||||||
res
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -441,13 +441,13 @@ where
|
|||||||
|
|
||||||
impl<S> fmt::Debug for Field<S> {
|
impl<S> fmt::Debug for Field<S> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
let res = writeln!(f, "\nMultipartField: {}", self.ct);
|
writeln!(f, "\nMultipartField: {}", self.ct)?;
|
||||||
let _ = writeln!(f, " boundary: {}", self.inner.borrow().boundary);
|
writeln!(f, " boundary: {}", self.inner.borrow().boundary)?;
|
||||||
let _ = writeln!(f, " headers:");
|
writeln!(f, " headers:")?;
|
||||||
for (key, val) in self.headers.iter() {
|
for (key, val) in self.headers.iter() {
|
||||||
let _ = writeln!(f, " {:?}: {:?}", key, val);
|
writeln!(f, " {:?}: {:?}", key, val)?;
|
||||||
}
|
}
|
||||||
res
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user