summaryrefslogtreecommitdiffstats
path: root/src/transport.rs
diff options
context:
space:
mode:
authorsoftprops <d.tangren@gmail.com>2018-10-08 19:13:48 -0400
committersoftprops <d.tangren@gmail.com>2018-10-08 19:13:48 -0400
commit7859295cea87bb1bd12969066b99137185382314 (patch)
tree32f85c4f743913edc79ad71326584196fe884e0b /src/transport.rs
parentab345ee5880fa9d17ef4e2a90dd06b837ad190f5 (diff)
try to get a consistent and repeatable codestyle going
Diffstat (limited to 'src/transport.rs')
-rw-r--r--src/transport.rs25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/transport.rs b/src/transport.rs
index 0b52b60..d8c1ea1 100644
--- a/src/transport.rs
+++ b/src/transport.rs
@@ -52,12 +52,13 @@ pub enum Transport {
}
impl fmt::Debug for Transport {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(
+ &self,
+ f: &mut fmt::Formatter,
+ ) -> fmt::Result {
match *self {
Transport::Tcp { ref host, .. } => write!(f, "Tcp({})", host),
- Transport::EncryptedTcp { ref host, .. } => {
- write!(f, "EncryptedTcp({})", host)
- }
+ Transport::EncryptedTcp { ref host, .. } => write!(f, "EncryptedTcp({})", host),
#[cfg(feature = "unix-socket")]
Transport::Unix { ref path, .. } => write!(f, "Unix({})", path),
}
@@ -128,18 +129,13 @@ impl Transport {
let res = self.send_request(req)?;
match res.status() {
- StatusCode::OK
- | StatusCode::CREATED
- | StatusCode::SWITCHING_PROTOCOLS => {
- let chunk =
- self.runtime().block_on(res.into_body().concat2())?;
+ StatusCode::OK | StatusCode::CREATED | StatusCode::SWITCHING_PROTOCOLS => {
+ let chunk = self.runtime().block_on(res.into_body().concat2())?;
Ok(Box::new(Cursor::new(
chunk.into_iter().collect::<Vec<u8>>(),
)))
}
- StatusCode::NO_CONTENT => {
- Ok(Box::new(BufReader::new("".as_bytes())))
- }
+ StatusCode::NO_CONTENT => Ok(Box::new(BufReader::new("".as_bytes()))),
// todo: constantize these
StatusCode::BAD_REQUEST => Err(Error::Fault {
code: res.status(),
@@ -206,7 +202,10 @@ impl Transport {
/// Extract the error message content from an HTTP response that
/// contains a Docker JSON error structure.
- fn get_error_message(&self, res: Response<Body>) -> Option<String> {
+ fn get_error_message(
+ &self,
+ res: Response<Body>,
+ ) -> Option<String> {
let chunk = match self.runtime().block_on(res.into_body().concat2()) {
Ok(c) => c,
Err(..) => return None,