diff --git a/.rustfmt.toml b/.rustfmt.toml deleted file mode 100644 index b4d1e94..0000000 --- a/.rustfmt.toml +++ /dev/null @@ -1,5 +0,0 @@ -version = "Two" -use_field_init_shorthand = true -merge_imports = true -wrap_comments = true -use_try_shorthand = true \ No newline at end of file diff --git a/rustfmt.toml b/rustfmt.toml index 0f780d3..608658f 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,6 +1,6 @@ -# https://github.com/rust-lang/rustfmt/blob/master/Configurations.md#fn_args_layout -fn_args_layout = "Vertical" -# https://github.com/rust-lang/rustfmt/blob/master/Configurations.md#merge_imports -merge_imports = true +# https://github.com/rust-lang/rustfmt/blob/master/Configurations.md#fn_params_layout +fn_params_layout = "Vertical" +# https://github.com/rust-lang/rustfmt/blob/master/Configurations.md#imports_granularity +imports_granularity = "Crate" # https://github.com/rust-lang/rustfmt/blob/master/Configurations.md#format_code_in_doc_comments format_code_in_doc_comments = true \ No newline at end of file diff --git a/src/client.rs b/src/client.rs index b99f7ce..b5b1052 100644 --- a/src/client.rs +++ b/src/client.rs @@ -43,11 +43,17 @@ impl AsyncWrite for UnixStream { self.project().unix_stream.poll_write(cx, buf) } - fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { + fn poll_flush( + self: Pin<&mut Self>, + cx: &mut Context<'_>, + ) -> Poll> { self.project().unix_stream.poll_flush(cx) } - fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { + fn poll_shutdown( + self: Pin<&mut Self>, + cx: &mut Context<'_>, + ) -> Poll> { self.project().unix_stream.poll_shutdown(cx) } } @@ -61,11 +67,17 @@ impl hyper::rt::Write for UnixStream { self.project().unix_stream.poll_write(cx, buf) } - fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { + fn poll_flush( + self: Pin<&mut Self>, + cx: &mut Context<'_>, + ) -> Poll> { self.project().unix_stream.poll_flush(cx) } - fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { + fn poll_shutdown( + self: Pin<&mut Self>, + cx: &mut Context<'_>, + ) -> Poll> { self.project().unix_stream.poll_shutdown(cx) } } @@ -98,12 +110,12 @@ impl hyper::rt::Read for UnixStream { /// ``` /// use http_body_util::Full; /// use hyper::body::Bytes; -/// use hyper_util::client::legacy::Client; -/// use hyper_util::rt::TokioExecutor; +/// use hyper_util::{client::legacy::Client, rt::TokioExecutor}; /// use hyperlocal::UnixConnector; /// /// let connector = UnixConnector; -/// let client: Client> = Client::builder(TokioExecutor::new()).build(connector); +/// let client: Client> = +/// Client::builder(TokioExecutor::new()).build(connector); /// ``` /// /// # Note @@ -121,7 +133,10 @@ impl Service for UnixConnector { type Future = Pin> + Send + 'static>>; - fn call(&mut self, req: Uri) -> Self::Future { + fn call( + &mut self, + req: Uri, + ) -> Self::Future { let fut = async move { let path = parse_socket_path(&req)?; UnixStream::connect(path).await @@ -130,7 +145,10 @@ impl Service for UnixConnector { Box::pin(fut) } - fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll> { + fn poll_ready( + &mut self, + _cx: &mut Context<'_>, + ) -> Poll> { Poll::Ready(Ok(())) } } diff --git a/src/uri.rs b/src/uri.rs index 1b8739f..9c5d23e 100644 --- a/src/uri.rs +++ b/src/uri.rs @@ -7,8 +7,8 @@ use std::path::Path; /// /// # Example /// ``` -/// use hyperlocal::Uri; /// use hyper::Uri as HyperUri; +/// use hyperlocal::Uri; /// /// let uri: HyperUri = Uri::new("/tmp/hyperlocal.sock", "/").into(); /// ``` @@ -22,7 +22,10 @@ impl Uri { /// /// # Panics /// Will panic if path is not absolute and/or a malformed path string. - pub fn new(socket: impl AsRef, path: &str) -> Self { + pub fn new( + socket: impl AsRef, + path: &str, + ) -> Self { let host = hex::encode(socket.as_ref().to_string_lossy().as_bytes()); let host_str = format!("unix://{host}:0{path}"); let hyper_uri: HyperUri = host_str.parse().unwrap();