From fc7f03523c67d5fccdc2a9810579f013e47979b0 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Mon, 18 Feb 2019 13:21:25 +0100 Subject: [PATCH] cleanup Error::from is already a function taking 1 parameter, there's no need to wrap it with `|e| Error::from(e)`. Signed-off-by: Wolfgang Bumiller --- src/bin/proxmox-backup-proxy.rs | 2 +- src/client/http_client.rs | 4 ++-- src/server/rest.rs | 2 +- src/tools/fs.rs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/bin/proxmox-backup-proxy.rs b/src/bin/proxmox-backup-proxy.rs index 38b9ac69..03e71563 100644 --- a/src/bin/proxmox-backup-proxy.rs +++ b/src/bin/proxmox-backup-proxy.rs @@ -69,7 +69,7 @@ fn run() -> Result<(), Error> { let acceptor = std::sync::Arc::new(tokio_tls::TlsAcceptor::from(acceptor)); let connections = listener .incoming() - .map_err(|e| Error::from(e)) + .map_err(Error::from) .and_then(move |sock| acceptor.accept(sock).map_err(|e| e.into())) .then(|r| match r { // accept()s can fail here with an Err() when eg. the client rejects diff --git a/src/client/http_client.rs b/src/client/http_client.rs index 48206859..eca17520 100644 --- a/src/client/http_client.rs +++ b/src/client/http_client.rs @@ -43,12 +43,12 @@ impl HttpClient { let future = client .request(request) - .map_err(|e| Error::from(e)) + .map_err(Error::from) .and_then(|resp| { let status = resp.status(); - resp.into_body().concat2().map_err(|e| Error::from(e)) + resp.into_body().concat2().map_err(Error::from) .and_then(move |data| { let text = String::from_utf8(data.to_vec()).unwrap(); diff --git a/src/server/rest.rs b/src/server/rest.rs index 824a07c4..e92406c5 100644 --- a/src/server/rest.rs +++ b/src/server/rest.rs @@ -179,7 +179,7 @@ fn proxy_protected_request( let resp = hyper::client::Client::new() .request(request) - .map_err(|e| Error::from(e)) + .map_err(Error::from) .map(|mut resp| { resp.extensions_mut().insert(NoLogExtension()); resp diff --git a/src/tools/fs.rs b/src/tools/fs.rs index b82e984b..28194ae2 100644 --- a/src/tools/fs.rs +++ b/src/tools/fs.rs @@ -86,7 +86,7 @@ impl Iterator for ReadDir { fn next(&mut self) -> Option { self.iter.next().map(|res| { res.map(|entry| ReadDirEntry { entry, parent_fd: self.dir_fd }) - .map_err(|e| Error::from(e)) + .map_err(Error::from) }) } }