Apply suggestions from code review

This commit is contained in:
Rob Ede 2021-06-26 14:48:43 +01:00 committed by GitHub
parent cd5322ddea
commit 72838752a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 3 deletions

View File

@ -515,9 +515,9 @@ where
cx: &mut Context<'_>,
) -> Result<(), DispatchError> {
// Handle `EXPECT: 100-Continue` header
// set dispatcher state so the future is pinned.
let mut this = self.as_mut().project();
if req.head().expect() {
// set dispatcher state so the future is pinned.
let task = this.flow.expect.call(req);
this.state.set(State::ExpectCall(task));
} else {

View File

@ -282,7 +282,7 @@ impl HttpRequest {
if let Ok(cookies) = self.cookies() {
for cookie in cookies.iter() {
if cookie.name() == name {
return Some(cookie.clone());
return Some(cookie.to_owned());
}
}
}

View File

@ -132,7 +132,10 @@ impl<B> HttpResponse<B> {
pub fn del_cookie(&mut self, name: &str) -> usize {
let headers = self.headers_mut();
let vals: Vec<HeaderValue> = headers.get_all(header::SET_COOKIE).cloned().collect();
let vals: Vec<HeaderValue> = headers
.get_all(header::SET_COOKIE)
.map(|v| v.to_owned())
.collect();
headers.remove(header::SET_COOKIE);