mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-23 15:51:06 +01:00
clippy
This commit is contained in:
parent
d28ab6eaa1
commit
da0a806e8d
@ -135,7 +135,7 @@ async fn increment(session: Session, user: Option<Identity>) -> HttpResponse {
|
||||
.get::<i32>("counter")
|
||||
.unwrap_or(Some(0))
|
||||
.map_or(1, |inner| inner + 1);
|
||||
session.insert("counter", &counter).unwrap();
|
||||
session.insert("counter", counter).unwrap();
|
||||
|
||||
HttpResponse::Ok().json(&EndpointResponse {
|
||||
user_id,
|
||||
|
@ -674,7 +674,7 @@ pub mod test_helpers {
|
||||
.get::<i32>("counter")
|
||||
.unwrap_or(Some(0))
|
||||
.map_or(1, |inner| inner + 1);
|
||||
session.insert("counter", &counter)?;
|
||||
session.insert("counter", counter)?;
|
||||
|
||||
Ok(HttpResponse::Ok().json(&IndexResponse { user_id, counter }))
|
||||
}
|
||||
|
@ -222,7 +222,7 @@ impl Session {
|
||||
req: &mut ServiceRequest,
|
||||
data: impl IntoIterator<Item = (String, String)>,
|
||||
) {
|
||||
let session = Session::get_session(&mut *req.extensions_mut());
|
||||
let session = Session::get_session(&mut req.extensions_mut());
|
||||
let mut inner = session.0.borrow_mut();
|
||||
inner.state.extend(data);
|
||||
}
|
||||
@ -285,7 +285,7 @@ impl FromRequest for Session {
|
||||
|
||||
#[inline]
|
||||
fn from_request(req: &HttpRequest, _: &mut Payload) -> Self::Future {
|
||||
ready(Ok(Session::get_session(&mut *req.extensions_mut())))
|
||||
ready(Ok(Session::get_session(&mut req.extensions_mut())))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,13 +15,13 @@ pub trait SessionExt {
|
||||
|
||||
impl SessionExt for HttpRequest {
|
||||
fn get_session(&self) -> Session {
|
||||
Session::get_session(&mut *self.extensions_mut())
|
||||
Session::get_session(&mut self.extensions_mut())
|
||||
}
|
||||
}
|
||||
|
||||
impl SessionExt for ServiceRequest {
|
||||
fn get_session(&self) -> Session {
|
||||
Session::get_session(&mut *self.extensions_mut())
|
||||
Session::get_session(&mut self.extensions_mut())
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,6 +33,6 @@ impl SessionExt for ServiceResponse {
|
||||
|
||||
impl<'a> SessionExt for GuardContext<'a> {
|
||||
fn get_session(&self) -> Session {
|
||||
Session::get_session(&mut *self.req_data_mut())
|
||||
Session::get_session(&mut self.req_data_mut())
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user