From 16906c595120f9524107fd777ee099d2dd68e886 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Thu, 17 May 2018 12:23:37 -0700 Subject: [PATCH] clippy warnings --- src/fs.rs | 2 +- src/httprequest.rs | 4 ++-- src/server/encoding.rs | 3 +++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/fs.rs b/src/fs.rs index 2de35994e..4234ff36c 100644 --- a/src/fs.rs +++ b/src/fs.rs @@ -332,8 +332,8 @@ impl Responder for NamedFile { Ok(resp.finish()) } else { let reader = ChunkedReadFile { + offset, size: length, - offset: offset, cpu_pool: self.cpu_pool.unwrap_or_else(|| req.cpu_pool().clone()), file: Some(self.file), fut: None, diff --git a/src/httprequest.rs b/src/httprequest.rs index a21c92298..0a14ca043 100644 --- a/src/httprequest.rs +++ b/src/httprequest.rs @@ -367,7 +367,7 @@ impl HttpRequest { /// Get a reference to the Params object. /// Params is a container for url query parameters. pub fn query<'a>(&'a self) -> &'a Params { - if let None = self.extensions().get::() { + if self.extensions().get::().is_none() { let mut params: Params<'a> = Params::new(); for (key, val) in form_urlencoded::parse(self.query_string().as_ref()) { params.add(key, val); @@ -394,7 +394,7 @@ impl HttpRequest { /// Load request cookies. pub fn cookies(&self) -> Result<&Vec>, CookieParseError> { - if let None = self.extensions().get::() { + if self.extensions().get::().is_none() { let msg = self.as_mut(); let mut cookies = Vec::new(); for hdr in msg.headers.get_all(header::COOKIE) { diff --git a/src/server/encoding.rs b/src/server/encoding.rs index 17209041b..587475659 100644 --- a/src/server/encoding.rs +++ b/src/server/encoding.rs @@ -386,6 +386,8 @@ impl ContentEncoder { let version = resp.version().unwrap_or_else(|| req.version); let is_head = req.method == Method::HEAD; let mut len = 0; + + #[cfg_attr(feature = "cargo-clippy", allow(match_ref_pats))] let has_body = match resp.body() { &Body::Empty => false, &Body::Binary(ref bin) => { @@ -424,6 +426,7 @@ impl ContentEncoder { ContentEncoding::Identity }; + #[cfg_attr(feature = "cargo-clippy", allow(match_ref_pats))] let mut transfer = match resp.body() { &Body::Empty => { if req.method != Method::HEAD {