From 27a6d2a7f02a3590a65ea7d7ee285e3965479602 Mon Sep 17 00:00:00 2001 From: Jens Reimann Date: Fri, 26 Jan 2024 09:13:11 +0100 Subject: [PATCH] fix: drop unused type arguments, clean up --- src/config.rs | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/config.rs b/src/config.rs index 917aa09..2804457 100644 --- a/src/config.rs +++ b/src/config.rs @@ -7,19 +7,13 @@ pub mod openid { use super::*; /// OpenID Connect client configuration + #[non_exhaustive] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct Config { /// The client ID pub client_id: String, /// The OpenID connect issuer URL. pub issuer_url: String, - #[serde(default)] - /// Additional, non-required configuration, with a default. - pub additional: Additional, - } - - #[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)] - pub struct Additional { /// An override for the end session URL. pub end_session_url: Option, /// The URL to navigate to after the logout has been completed. @@ -34,6 +28,8 @@ pub mod openid { /// Those audiences are allowed in addition to the client ID. pub additional_trusted_audiences: Vec, } + + impl Config {} } /// Configuration for OAuth2 @@ -41,6 +37,12 @@ pub mod oauth2 { use super::*; /// Plain OAuth2 client configuration + /// + /// ## Non-exhaustive + /// + /// This struct is `#[non_exhaustive]`, so it is not possible to directly create a struct. You can do this using + /// the [`Config::new`] function. + #[non_exhaustive] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct Config { /// The client ID @@ -52,14 +54,11 @@ pub mod oauth2 { } impl Config { - pub fn new(client_id: C, auth_url: A, token_url: T) -> Self - where - C: Into, - A: Into, - T: Into, - S: IntoIterator, - I: Into, - { + pub fn new( + client_id: impl Into, + auth_url: impl Into, + token_url: impl Into, + ) -> Self { Self { client_id: client_id.into(), auth_url: auth_url.into(),