You've already forked authentication-service
mirror of
https://github.com/matrix-org/matrix-authentication-service.git
synced 2025-07-31 09:24:31 +03:00
Fix Clippy warnings about enum size variants difference
This commit is contained in:
@ -39,18 +39,18 @@ impl Viewer {
|
|||||||
/// Represents the current viewer's session
|
/// Represents the current viewer's session
|
||||||
#[derive(Union)]
|
#[derive(Union)]
|
||||||
pub enum ViewerSession {
|
pub enum ViewerSession {
|
||||||
BrowserSession(BrowserSession),
|
BrowserSession(Box<BrowserSession>),
|
||||||
OAuth2Session(OAuth2Session),
|
OAuth2Session(Box<OAuth2Session>),
|
||||||
Anonymous(Anonymous),
|
Anonymous(Anonymous),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ViewerSession {
|
impl ViewerSession {
|
||||||
pub fn browser_session(session: mas_data_model::BrowserSession) -> Self {
|
pub fn browser_session(session: mas_data_model::BrowserSession) -> Self {
|
||||||
Self::BrowserSession(BrowserSession(session))
|
Self::BrowserSession(Box::new(BrowserSession(session)))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn oauth2_session(session: mas_data_model::Session) -> Self {
|
pub fn oauth2_session(session: mas_data_model::Session) -> Self {
|
||||||
Self::OAuth2Session(OAuth2Session(session))
|
Self::OAuth2Session(Box::new(OAuth2Session(session)))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn anonymous() -> Self {
|
pub fn anonymous() -> Self {
|
||||||
|
@ -35,7 +35,7 @@ pub struct EndBrowserSessionInput {
|
|||||||
/// The payload of the `endBrowserSession` mutation.
|
/// The payload of the `endBrowserSession` mutation.
|
||||||
pub enum EndBrowserSessionPayload {
|
pub enum EndBrowserSessionPayload {
|
||||||
NotFound,
|
NotFound,
|
||||||
Ended(mas_data_model::BrowserSession),
|
Ended(Box<mas_data_model::BrowserSession>),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The status of the `endBrowserSession` mutation.
|
/// The status of the `endBrowserSession` mutation.
|
||||||
@ -61,7 +61,7 @@ impl EndBrowserSessionPayload {
|
|||||||
/// Returns the ended session.
|
/// Returns the ended session.
|
||||||
async fn browser_session(&self) -> Option<BrowserSession> {
|
async fn browser_session(&self) -> Option<BrowserSession> {
|
||||||
match self {
|
match self {
|
||||||
Self::Ended(session) => Some(BrowserSession(session.clone())),
|
Self::Ended(session) => Some(BrowserSession(*session.clone())),
|
||||||
Self::NotFound => None,
|
Self::NotFound => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -96,6 +96,6 @@ impl BrowserSessionMutations {
|
|||||||
|
|
||||||
repo.save().await?;
|
repo.save().await?;
|
||||||
|
|
||||||
Ok(EndBrowserSessionPayload::Ended(session))
|
Ok(EndBrowserSessionPayload::Ended(Box::new(session)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user