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

use mem::take where possible (#1507)

This commit is contained in:
Rob Ede
2020-05-17 02:54:42 +01:00
committed by GitHub
parent 201090d7a2
commit f3b0233477
10 changed files with 20 additions and 32 deletions

View File

@ -200,8 +200,7 @@ impl Session {
.extensions()
.get::<Rc<RefCell<SessionInner>>>()
{
let state =
std::mem::replace(&mut s_impl.borrow_mut().state, HashMap::new());
let state = std::mem::take(&mut s_impl.borrow_mut().state);
(s_impl.borrow().status.clone(), Some(state.into_iter()))
} else {
(SessionStatus::Unchanged, None)