From 08962920065e6bc1e5e4b5333f829f0f70ffddcd Mon Sep 17 00:00:00 2001 From: Quentin Gliech Date: Mon, 4 Sep 2023 16:35:44 +0200 Subject: [PATCH] Fix Clippy warnings about enum size variants difference --- crates/graphql/src/model/viewer/mod.rs | 8 ++++---- crates/graphql/src/mutations/browser_session.rs | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/graphql/src/model/viewer/mod.rs b/crates/graphql/src/model/viewer/mod.rs index b90083a2..c382109e 100644 --- a/crates/graphql/src/model/viewer/mod.rs +++ b/crates/graphql/src/model/viewer/mod.rs @@ -39,18 +39,18 @@ impl Viewer { /// Represents the current viewer's session #[derive(Union)] pub enum ViewerSession { - BrowserSession(BrowserSession), - OAuth2Session(OAuth2Session), + BrowserSession(Box), + OAuth2Session(Box), Anonymous(Anonymous), } impl ViewerSession { 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 { - Self::OAuth2Session(OAuth2Session(session)) + Self::OAuth2Session(Box::new(OAuth2Session(session))) } pub fn anonymous() -> Self { diff --git a/crates/graphql/src/mutations/browser_session.rs b/crates/graphql/src/mutations/browser_session.rs index 3e0337a9..147de040 100644 --- a/crates/graphql/src/mutations/browser_session.rs +++ b/crates/graphql/src/mutations/browser_session.rs @@ -35,7 +35,7 @@ pub struct EndBrowserSessionInput { /// The payload of the `endBrowserSession` mutation. pub enum EndBrowserSessionPayload { NotFound, - Ended(mas_data_model::BrowserSession), + Ended(Box), } /// The status of the `endBrowserSession` mutation. @@ -61,7 +61,7 @@ impl EndBrowserSessionPayload { /// Returns the ended session. async fn browser_session(&self) -> Option { match self { - Self::Ended(session) => Some(BrowserSession(session.clone())), + Self::Ended(session) => Some(BrowserSession(*session.clone())), Self::NotFound => None, } } @@ -96,6 +96,6 @@ impl BrowserSessionMutations { repo.save().await?; - Ok(EndBrowserSessionPayload::Ended(session)) + Ok(EndBrowserSessionPayload::Ended(Box::new(session))) } }