Fix a few more clippy lints

This commit is contained in:
Quentin Gliech
2025-08-18 10:45:20 +02:00
parent bef50474ab
commit 8dd096ce60
6 changed files with 8 additions and 38 deletions

View File

@@ -289,7 +289,7 @@ pub struct UpstreamOAuthProvider {
impl PartialOrd for UpstreamOAuthProvider {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.id.cmp(&other.id))
Some(self.cmp(other))
}
}

View File

@@ -8,8 +8,7 @@ use anyhow::Context as _;
use async_graphql::{Context, Description, Enum, ID, Object};
use chrono::{DateTime, Utc};
use mas_storage::{oauth2::OAuth2ClientRepository, user::BrowserSessionRepository};
use oauth2_types::{oidc::ApplicationType, scope::Scope};
use ulid::Ulid;
use oauth2_types::oidc::ApplicationType;
use url::Url;
use super::{BrowserSession, NodeType, SessionState, User, UserAgent};
@@ -200,33 +199,3 @@ impl OAuth2Client {
}
}
}
/// An OAuth 2.0 consent represents the scope a user consented to grant to a
/// client.
#[derive(Description)]
pub struct OAuth2Consent {
scope: Scope,
client_id: Ulid,
}
#[Object(use_type_description)]
impl OAuth2Consent {
/// Scope consented by the user for this client.
pub async fn scope(&self) -> String {
self.scope.to_string()
}
/// OAuth 2.0 client for which the user granted access.
pub async fn client(&self, ctx: &Context<'_>) -> Result<OAuth2Client, async_graphql::Error> {
let state = ctx.state();
let mut repo = state.repository().await?;
let client = repo
.oauth2_client()
.lookup(self.client_id)
.await?
.context("Could not load client")?;
repo.cancel().await?;
Ok(OAuth2Client(client))
}
}

View File

@@ -72,6 +72,7 @@ pub(crate) use sprintf;
#[derive(Debug, thiserror::Error)]
#[error(transparent)]
#[allow(dead_code)]
enum Error {
Format(#[from] self::formatter::FormatError),
Parse(Box<self::parser::Error>),

View File

@@ -697,7 +697,7 @@ mod tests {
// List all logins
let logins = repo.compat_sso_login().list(all, pagination).await.unwrap();
assert!(!logins.has_next_page);
assert_eq!(logins.edges, &[login.clone()]);
assert_eq!(logins.edges, vec![login.clone()]);
// List the logins for the user
let logins = repo
@@ -706,7 +706,7 @@ mod tests {
.await
.unwrap();
assert!(!logins.has_next_page);
assert_eq!(logins.edges, &[login.clone()]);
assert_eq!(logins.edges, vec![login.clone()]);
// List only the pending logins for the user
let logins = repo

View File

@@ -328,7 +328,7 @@ register_templates! {
/// Render the Swagger API reference
pub fn render_swagger(ApiDocContext) { "swagger/doc.html" }
/// Render the Swagger OAuth2 callback page
/// Render the Swagger OAuth callback page
pub fn render_swagger_callback(ApiDocContext) { "swagger/oauth2-redirect.html" }
/// Render the login page
@@ -382,7 +382,7 @@ register_templates! {
/// Render the account recovery disabled page
pub fn render_recovery_disabled(WithLanguage<EmptyContext>) { "pages/recovery/disabled.html" }
/// Render the form used by the form_post response mode
/// Render the form used by the `form_post` response mode
pub fn render_form_post<T: Serialize>(WithLanguage<FormPostContext<T>>) { "form_post.html" }
/// Render the HTML error page

View File

@@ -2155,7 +2155,7 @@
"type": "boolean"
},
"on_backchannel_logout": {
"description": "What to do when receiving an OIDC Backchannel logout request.\n\nDefaults to \"do_nothing\".",
"description": "What to do when receiving an OIDC Backchannel logout request.\n\nDefaults to `do_nothing`.",
"allOf": [
{
"$ref": "#/definitions/OnBackchannelLogout"