From e936d5ea740e886195fbdee9dbf6b276d06f8081 Mon Sep 17 00:00:00 2001 From: Martin Algesten Date: Sun, 20 Oct 2019 10:41:35 +0200 Subject: [PATCH] cargo fmt --- src/agent.rs | 1 - src/body.rs | 2 +- src/error.rs | 2 +- src/stream.rs | 9 ++++++--- tests/https-agent.rs | 3 ++- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/agent.rs b/src/agent.rs index 24cb6c9..b87ab6d 100644 --- a/src/agent.rs +++ b/src/agent.rs @@ -284,5 +284,4 @@ mod tests { request.set("Foo", "Bar"); }); } - } diff --git a/src/body.rs b/src/body.rs index 2eba430..02db9fe 100644 --- a/src/body.rs +++ b/src/body.rs @@ -95,7 +95,7 @@ impl Payload { let len = bytes.len(); let cursor = Cursor::new(bytes); SizedReader::new(Some(len), Box::new(cursor)) - }, + } } } } diff --git a/src/error.rs b/src/error.rs index a25b73e..1ec8bfd 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,5 +1,5 @@ -use std::io::Error as IoError; use std::fmt; +use std::io::Error as IoError; /// Errors that are translated to ["synthetic" responses](struct.Response.html#method.synthetic). #[derive(Debug)] diff --git a/src/stream.rs b/src/stream.rs index 352d4c2..50b293b 100644 --- a/src/stream.rs +++ b/src/stream.rs @@ -4,10 +4,10 @@ use std::net::TcpStream; use std::net::ToSocketAddrs; use std::time::Duration; -#[cfg(feature = "tls")] -use rustls::StreamOwned; #[cfg(feature = "tls")] use rustls::ClientSession; +#[cfg(feature = "tls")] +use rustls::StreamOwned; use crate::error::Error; use crate::unit::Unit; @@ -72,7 +72,10 @@ impl Read for Stream { } #[cfg(feature = "tls")] -fn read_https(stream: &mut StreamOwned, buf: &mut [u8]) -> IoResult { +fn read_https( + stream: &mut StreamOwned, + buf: &mut [u8], +) -> IoResult { match stream.read(buf) { Ok(size) => Ok(size), Err(ref e) if is_close_notify(e) => Ok(0), diff --git a/tests/https-agent.rs b/tests/https-agent.rs index b246725..5e54a8f 100644 --- a/tests/https-agent.rs +++ b/tests/https-agent.rs @@ -4,7 +4,8 @@ use std::io::Read; #[test] fn tls_connection_close() { let agent = ureq::Agent::default().build(); - let resp = agent.get("https://example.com/404") + let resp = agent + .get("https://example.com/404") .set("Connection", "close") .call(); assert_eq!(resp.status(), 404);