1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-12-01 22:11:20 +00:00

clippy warnings

This commit is contained in:
Nikolay Kim 2018-05-17 12:23:37 -07:00
parent 45e9aaa462
commit 16906c5951
3 changed files with 6 additions and 3 deletions

View file

@ -332,8 +332,8 @@ impl Responder for NamedFile {
Ok(resp.finish()) Ok(resp.finish())
} else { } else {
let reader = ChunkedReadFile { let reader = ChunkedReadFile {
offset,
size: length, size: length,
offset: offset,
cpu_pool: self.cpu_pool.unwrap_or_else(|| req.cpu_pool().clone()), cpu_pool: self.cpu_pool.unwrap_or_else(|| req.cpu_pool().clone()),
file: Some(self.file), file: Some(self.file),
fut: None, fut: None,

View file

@ -367,7 +367,7 @@ impl<S> HttpRequest<S> {
/// Get a reference to the Params object. /// Get a reference to the Params object.
/// Params is a container for url query parameters. /// Params is a container for url query parameters.
pub fn query<'a>(&'a self) -> &'a Params { pub fn query<'a>(&'a self) -> &'a Params {
if let None = self.extensions().get::<Query>() { if self.extensions().get::<Query>().is_none() {
let mut params: Params<'a> = Params::new(); let mut params: Params<'a> = Params::new();
for (key, val) in form_urlencoded::parse(self.query_string().as_ref()) { for (key, val) in form_urlencoded::parse(self.query_string().as_ref()) {
params.add(key, val); params.add(key, val);
@ -394,7 +394,7 @@ impl<S> HttpRequest<S> {
/// Load request cookies. /// Load request cookies.
pub fn cookies(&self) -> Result<&Vec<Cookie<'static>>, CookieParseError> { pub fn cookies(&self) -> Result<&Vec<Cookie<'static>>, CookieParseError> {
if let None = self.extensions().get::<Query>() { if self.extensions().get::<Query>().is_none() {
let msg = self.as_mut(); let msg = self.as_mut();
let mut cookies = Vec::new(); let mut cookies = Vec::new();
for hdr in msg.headers.get_all(header::COOKIE) { for hdr in msg.headers.get_all(header::COOKIE) {

View file

@ -386,6 +386,8 @@ impl ContentEncoder {
let version = resp.version().unwrap_or_else(|| req.version); let version = resp.version().unwrap_or_else(|| req.version);
let is_head = req.method == Method::HEAD; let is_head = req.method == Method::HEAD;
let mut len = 0; let mut len = 0;
#[cfg_attr(feature = "cargo-clippy", allow(match_ref_pats))]
let has_body = match resp.body() { let has_body = match resp.body() {
&Body::Empty => false, &Body::Empty => false,
&Body::Binary(ref bin) => { &Body::Binary(ref bin) => {
@ -424,6 +426,7 @@ impl ContentEncoder {
ContentEncoding::Identity ContentEncoding::Identity
}; };
#[cfg_attr(feature = "cargo-clippy", allow(match_ref_pats))]
let mut transfer = match resp.body() { let mut transfer = match resp.body() {
&Body::Empty => { &Body::Empty => {
if req.method != Method::HEAD { if req.method != Method::HEAD {