mirror of https://github.com/fafhrd91/actix-web
chore(awc): address clippy warnings (#3909)
This commit is contained in:
parent
bc27fd2724
commit
80d7d9c01a
|
|
@ -263,13 +263,9 @@ impl ClientRequest {
|
||||||
/// ```
|
/// ```
|
||||||
#[cfg(feature = "cookies")]
|
#[cfg(feature = "cookies")]
|
||||||
pub fn cookie(mut self, cookie: Cookie<'_>) -> Self {
|
pub fn cookie(mut self, cookie: Cookie<'_>) -> Self {
|
||||||
if self.cookies.is_none() {
|
self.cookies
|
||||||
let mut jar = CookieJar::new();
|
.get_or_insert_with(CookieJar::new)
|
||||||
jar.add(cookie.into_owned());
|
.add(cookie.into_owned());
|
||||||
self.cookies = Some(jar)
|
|
||||||
} else {
|
|
||||||
self.cookies.as_mut().unwrap().add(cookie.into_owned());
|
|
||||||
}
|
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -125,13 +125,9 @@ impl WebsocketsRequest {
|
||||||
/// Set a cookie
|
/// Set a cookie
|
||||||
#[cfg(feature = "cookies")]
|
#[cfg(feature = "cookies")]
|
||||||
pub fn cookie(mut self, cookie: Cookie<'_>) -> Self {
|
pub fn cookie(mut self, cookie: Cookie<'_>) -> Self {
|
||||||
if self.cookies.is_none() {
|
self.cookies
|
||||||
let mut jar = CookieJar::new();
|
.get_or_insert_with(CookieJar::new)
|
||||||
jar.add(cookie.into_owned());
|
.add(cookie.into_owned());
|
||||||
self.cookies = Some(jar)
|
|
||||||
} else {
|
|
||||||
self.cookies.as_mut().unwrap().add(cookie.into_owned());
|
|
||||||
}
|
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue