chore(awc): address clippy warnings (#3909)

This commit is contained in:
Yuki Okushi 2026-02-08 10:30:19 +09:00 committed by GitHub
parent bc27fd2724
commit 80d7d9c01a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 14 deletions

View File

@ -263,13 +263,9 @@ impl ClientRequest {
/// ```
#[cfg(feature = "cookies")]
pub fn cookie(mut self, cookie: Cookie<'_>) -> Self {
if self.cookies.is_none() {
let mut jar = CookieJar::new();
jar.add(cookie.into_owned());
self.cookies = Some(jar)
} else {
self.cookies.as_mut().unwrap().add(cookie.into_owned());
}
self.cookies
.get_or_insert_with(CookieJar::new)
.add(cookie.into_owned());
self
}

View File

@ -125,13 +125,9 @@ impl WebsocketsRequest {
/// Set a cookie
#[cfg(feature = "cookies")]
pub fn cookie(mut self, cookie: Cookie<'_>) -> Self {
if self.cookies.is_none() {
let mut jar = CookieJar::new();
jar.add(cookie.into_owned());
self.cookies = Some(jar)
} else {
self.cookies.as_mut().unwrap().add(cookie.into_owned());
}
self.cookies
.get_or_insert_with(CookieJar::new)
.add(cookie.into_owned());
self
}