1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-25 06:39:22 +02:00

clippy warnings

This commit is contained in:
Nikolay Kim
2019-07-17 15:08:30 +06:00
parent ef3e1037a8
commit 4092c7f326
26 changed files with 84 additions and 90 deletions

View File

@ -21,6 +21,12 @@ pub struct ClientBuilder {
max_redirects: usize,
}
impl Default for ClientBuilder {
fn default() -> Self {
Self::new()
}
}
impl ClientBuilder {
pub fn new() -> Self {
ClientBuilder {

View File

@ -1,3 +1,4 @@
#![allow(clippy::borrow_interior_mutable_const)]
//! An HTTP Client
//!
//! ```rust

View File

@ -185,9 +185,7 @@ impl ClientRequest {
{
match HeaderName::try_from(key) {
Ok(key) => match value.try_into() {
Ok(value) => {
let _ = self.head.headers.append(key, value);
}
Ok(value) => self.head.headers.append(key, value),
Err(e) => self.err = Some(e.into()),
},
Err(e) => self.err = Some(e.into()),
@ -203,9 +201,7 @@ impl ClientRequest {
{
match HeaderName::try_from(key) {
Ok(key) => match value.try_into() {
Ok(value) => {
let _ = self.head.headers.insert(key, value);
}
Ok(value) => self.head.headers.insert(key, value),
Err(e) => self.err = Some(e.into()),
},
Err(e) => self.err = Some(e.into()),
@ -223,9 +219,7 @@ impl ClientRequest {
Ok(key) => {
if !self.head.headers.contains_key(&key) {
match value.try_into() {
Ok(value) => {
let _ = self.head.headers.insert(key, value);
}
Ok(value) => self.head.headers.insert(key, value),
Err(e) => self.err = Some(e.into()),
}
}
@ -257,9 +251,7 @@ impl ClientRequest {
HeaderValue: HttpTryFrom<V>,
{
match HeaderValue::try_from(value) {
Ok(value) => {
let _ = self.head.headers.insert(header::CONTENT_TYPE, value);
}
Ok(value) => self.head.headers.insert(header::CONTENT_TYPE, value),
Err(e) => self.err = Some(e.into()),
}
self
@ -321,7 +313,7 @@ impl ClientRequest {
/// }));
/// }
/// ```
pub fn cookie<'c>(mut self, cookie: Cookie<'c>) -> Self {
pub fn cookie(mut self, cookie: Cookie<'_>) -> Self {
if self.cookies.is_none() {
let mut jar = CookieJar::new();
jar.add(cookie.into_owned());
@ -465,7 +457,7 @@ impl ClientRequest {
});
// set request timeout
if let Some(timeout) = slf.timeout.or_else(|| config.timeout.clone()) {
if let Some(timeout) = slf.timeout.or_else(|| config.timeout) {
Either::B(Either::A(Timeout::new(fut, timeout).map_err(|e| {
if let Some(e) = e.into_inner() {
e

View File

@ -68,7 +68,7 @@ impl TestResponse {
}
/// Set cookie for this response
pub fn cookie<'a>(mut self, cookie: Cookie<'a>) -> Self {
pub fn cookie(mut self, cookie: Cookie<'_>) -> Self {
self.cookies.add(cookie.into_owned());
self
}

View File

@ -90,7 +90,7 @@ impl WebsocketsRequest {
}
/// Set a cookie
pub fn cookie<'c>(mut self, cookie: Cookie<'c>) -> Self {
pub fn cookie(mut self, cookie: Cookie<'_>) -> Self {
if self.cookies.is_none() {
let mut jar = CookieJar::new();
jar.add(cookie.into_owned());