1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-07-01 16:55:08 +02:00

fix clippy warning on nightly (#2088)

* fix clippy warning on nightly
This commit is contained in:
fakeshadow
2021-03-19 04:25:35 -07:00
committed by GitHub
parent 78fcd0237a
commit 351286486c
11 changed files with 30 additions and 52 deletions

View File

@ -113,7 +113,7 @@ pub struct AppConfig {
impl AppConfig {
pub(crate) fn new(secure: bool, addr: SocketAddr, host: String) -> Self {
AppConfig { secure, addr, host }
AppConfig { secure, host, addr }
}
/// Server host name.

View File

@ -173,11 +173,7 @@ pub mod dev {
impl BodyEncoding for ResponseBuilder {
fn get_encoding(&self) -> Option<ContentEncoding> {
if let Some(ref enc) = self.extensions().get::<Enc>() {
Some(enc.0)
} else {
None
}
self.extensions().get::<Enc>().map(|enc| enc.0)
}
fn encoding(&mut self, encoding: ContentEncoding) -> &mut Self {
@ -188,11 +184,7 @@ pub mod dev {
impl<B> BodyEncoding for Response<B> {
fn get_encoding(&self) -> Option<ContentEncoding> {
if let Some(ref enc) = self.extensions().get::<Enc>() {
Some(enc.0)
} else {
None
}
self.extensions().get::<Enc>().map(|enc| enc.0)
}
fn encoding(&mut self, encoding: ContentEncoding) -> &mut Self {

View File

@ -197,22 +197,23 @@ impl AcceptEncoding {
/// Parse a raw Accept-Encoding header value into an ordered list.
pub fn parse(raw: &str, encoding: ContentEncoding) -> ContentEncoding {
let mut encodings: Vec<_> = raw
let mut encodings = raw
.replace(' ', "")
.split(',')
.map(|l| AcceptEncoding::new(l))
.collect();
.flatten()
.collect::<Vec<_>>();
encodings.sort();
for enc in encodings {
if let Some(enc) = enc {
if encoding == ContentEncoding::Auto {
return enc.encoding;
} else if encoding == enc.encoding {
return encoding;
}
if encoding == ContentEncoding::Auto {
return enc.encoding;
} else if encoding == enc.encoding {
return encoding;
}
}
ContentEncoding::Identity
}
}

View File

@ -449,9 +449,9 @@ impl ServiceFactory<ServiceRequest> for ResourceFactory {
.collect::<Result<Vec<_>, _>>()?;
Ok(ResourceService {
routes,
app_data,
default,
routes,
})
})
}

View File

@ -774,10 +774,10 @@ where
};
TestServer {
ssl,
addr,
client,
system,
ssl,
server,
}
}