mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-27 17:22:57 +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")
|
.get::<i32>("counter")
|
||||||
.unwrap_or(Some(0))
|
.unwrap_or(Some(0))
|
||||||
.map_or(1, |inner| inner + 1);
|
.map_or(1, |inner| inner + 1);
|
||||||
session.insert("counter", &counter).unwrap();
|
session.insert("counter", counter).unwrap();
|
||||||
|
|
||||||
HttpResponse::Ok().json(&EndpointResponse {
|
HttpResponse::Ok().json(&EndpointResponse {
|
||||||
user_id,
|
user_id,
|
||||||
|
@ -674,7 +674,7 @@ pub mod test_helpers {
|
|||||||
.get::<i32>("counter")
|
.get::<i32>("counter")
|
||||||
.unwrap_or(Some(0))
|
.unwrap_or(Some(0))
|
||||||
.map_or(1, |inner| inner + 1);
|
.map_or(1, |inner| inner + 1);
|
||||||
session.insert("counter", &counter)?;
|
session.insert("counter", counter)?;
|
||||||
|
|
||||||
Ok(HttpResponse::Ok().json(&IndexResponse { user_id, counter }))
|
Ok(HttpResponse::Ok().json(&IndexResponse { user_id, counter }))
|
||||||
}
|
}
|
||||||
|
@ -222,7 +222,7 @@ impl Session {
|
|||||||
req: &mut ServiceRequest,
|
req: &mut ServiceRequest,
|
||||||
data: impl IntoIterator<Item = (String, String)>,
|
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();
|
let mut inner = session.0.borrow_mut();
|
||||||
inner.state.extend(data);
|
inner.state.extend(data);
|
||||||
}
|
}
|
||||||
@ -285,7 +285,7 @@ impl FromRequest for Session {
|
|||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn from_request(req: &HttpRequest, _: &mut Payload) -> Self::Future {
|
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 {
|
impl SessionExt for HttpRequest {
|
||||||
fn get_session(&self) -> Session {
|
fn get_session(&self) -> Session {
|
||||||
Session::get_session(&mut *self.extensions_mut())
|
Session::get_session(&mut self.extensions_mut())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SessionExt for ServiceRequest {
|
impl SessionExt for ServiceRequest {
|
||||||
fn get_session(&self) -> Session {
|
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> {
|
impl<'a> SessionExt for GuardContext<'a> {
|
||||||
fn get_session(&self) -> Session {
|
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