1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-11-29 21:11:17 +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())
} 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,

View file

@ -367,7 +367,7 @@ impl<S> HttpRequest<S> {
/// 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::<Query>() {
if self.extensions().get::<Query>().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<S> HttpRequest<S> {
/// Load request cookies.
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 mut cookies = Vec::new();
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 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 {