diff --git a/crates/cli/src/commands/manage.rs b/crates/cli/src/commands/manage.rs index 3a129b40..ab66a38f 100644 --- a/crates/cli/src/commands/manage.rs +++ b/crates/cli/src/commands/manage.rs @@ -694,7 +694,7 @@ impl Options { }) .await??; - req.upstream_provider_mappings.push((&provider, subject)); + req.upstream_provider_mappings.push((provider, subject)); } } } diff --git a/crates/config/src/sections/email.rs b/crates/config/src/sections/email.rs index 274d6c91..3d94be43 100644 --- a/crates/config/src/sections/email.rs +++ b/crates/config/src/sections/email.rs @@ -37,7 +37,7 @@ pub enum EmailSmtpMode { /// Plain text Plain, - /// StartTLS (starts as plain text then upgrade to TLS) + /// `StartTLS` (starts as plain text then upgrade to TLS) StartTls, /// TLS @@ -94,7 +94,7 @@ pub struct EmailConfig { hostname: Option, /// SMTP transport: Port to connect to. Default is 25 for plain, 465 for TLS - /// and 587 for StartTLS + /// and 587 for `StartTLS` #[serde(skip_serializing_if = "Option::is_none")] #[schemars(range(min = 1, max = 65535))] port: Option, diff --git a/crates/config/src/sections/http.rs b/crates/config/src/sections/http.rs index f60d1b5c..29059497 100644 --- a/crates/config/src/sections/http.rs +++ b/crates/config/src/sections/http.rs @@ -336,7 +336,7 @@ pub struct ListenerConfig { /// List of sockets to bind pub binds: Vec, - /// Accept HAProxy's Proxy Protocol V1 + /// Accept `HAProxy`'s Proxy Protocol V1 #[serde(default)] pub proxy_protocol: bool, diff --git a/crates/data-model/src/oauth2/client.rs b/crates/data-model/src/oauth2/client.rs index 57c428f3..02793cba 100644 --- a/crates/data-model/src/oauth2/client.rs +++ b/crates/data-model/src/oauth2/client.rs @@ -49,7 +49,7 @@ pub struct Client { /// Array of Redirection URI values used by the Client pub redirect_uris: Vec, - /// Array containing a list of the OAuth 2.0 response_type values that the + /// Array containing a list of the OAuth 2.0 `response_type` values that the /// Client is declaring that it will restrict itself to using pub response_types: Vec, @@ -83,15 +83,15 @@ pub struct Client { /// Client pub id_token_signed_response_alg: Option, - /// JWS alg algorithm REQUIRED for signing UserInfo Responses. + /// JWS alg algorithm REQUIRED for signing `UserInfo` Responses. pub userinfo_signed_response_alg: Option, /// Requested authentication method for the token endpoint pub token_endpoint_auth_method: Option, /// JWS alg algorithm that MUST be used for signing the JWT used to - /// authenticate the Client at the Token Endpoint for the private_key_jwt - /// and client_secret_jwt authentication methods + /// authenticate the Client at the Token Endpoint for the `private_key_jwt` + /// and `client_secret_jwt` authentication methods pub token_endpoint_auth_signing_alg: Option, /// URI using the https scheme that a third party can use to initiate a diff --git a/crates/data-model/src/user_agent.rs b/crates/data-model/src/user_agent.rs index 98b9e4ae..75d3555d 100644 --- a/crates/data-model/src/user_agent.rs +++ b/crates/data-model/src/user_agent.rs @@ -148,13 +148,6 @@ impl UserAgent { result.os_version = VALUE_UNKNOWN.into(); } - // Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like - // Gecko) Chrome/100.0.4896.133 Safari/537.36 - ("Mac OSX", "10.15.7") if user_agent.contains("Macintosh; Intel Mac OS X 10_15_7") => { - result.os = "macOS"; - result.os_version = VALUE_UNKNOWN.into(); - } - // Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) // Chrome/100.0.0.0 Safari/537.36 ("Linux", _) if user_agent.contains("X11; Linux x86_64") => { @@ -176,6 +169,8 @@ impl UserAgent { result.os_version = VALUE_UNKNOWN.into(); } + // Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like + // Gecko) Chrome/100.0.4896.133 Safari/537.36 // Safari also freezes the OS version // Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like // Gecko) Version/17.3.1 Safari/605.1.15 diff --git a/crates/email/src/transport.rs b/crates/email/src/transport.rs index 490e1029..52aac6d9 100644 --- a/crates/email/src/transport.rs +++ b/crates/email/src/transport.rs @@ -32,7 +32,7 @@ use thiserror::Error; pub enum SmtpMode { /// Plain text Plain, - /// StartTLS (starts as plain text then upgrade to TLS) + /// `StartTLS` (starts as plain text then upgrade to TLS) StartTls, /// TLS Tls, diff --git a/crates/graphql/src/lib.rs b/crates/graphql/src/lib.rs index 77e8a074..06485707 100644 --- a/crates/graphql/src/lib.rs +++ b/crates/graphql/src/lib.rs @@ -51,7 +51,7 @@ pub enum Requester { /// The requester is a browser session, stored in a cookie. BrowserSession(Box), - /// The requester is a OAuth2 session, with an access token. + /// The requester is a `OAuth2` session, with an access token. OAuth2Session(Box<(Session, Option)>), } diff --git a/crates/handlers/src/oauth2/token.rs b/crates/handlers/src/oauth2/token.rs index db3825ce..a11aab35 100644 --- a/crates/handlers/src/oauth2/token.rs +++ b/crates/handlers/src/oauth2/token.rs @@ -13,7 +13,7 @@ // limitations under the License. use axum::{extract::State, response::IntoResponse, Json, TypedHeader}; -use chrono::{DateTime, Duration, Utc}; +use chrono::Duration; use headers::{CacheControl, HeaderMap, HeaderMapExt, Pragma}; use hyper::StatusCode; use mas_axum_utils::{ @@ -46,33 +46,13 @@ use oauth2_types::{ }, scope, }; -use serde::Serialize; -use serde_with::{serde_as, skip_serializing_none}; use thiserror::Error; use tracing::debug; use ulid::Ulid; -use url::Url; use super::{generate_id_token, generate_token_pair}; use crate::{impl_from_error_for_route, BoundActivityTracker}; -#[serde_as] -#[skip_serializing_none] -#[derive(Serialize, Debug)] -struct CustomClaims { - #[serde(rename = "iss")] - issuer: Url, - #[serde(rename = "sub")] - subject: String, - #[serde(rename = "aud")] - audiences: Vec, - nonce: Option, - #[serde_as(as = "Option")] - auth_time: Option>, - at_hash: String, - c_hash: String, -} - #[derive(Debug, Error)] pub(crate) enum RouteError { #[error(transparent)] diff --git a/crates/handlers/src/passwords.rs b/crates/handlers/src/passwords.rs index 9ab63f1a..af3caf2b 100644 --- a/crates/handlers/src/passwords.rs +++ b/crates/handlers/src/passwords.rs @@ -100,10 +100,7 @@ impl PasswordManager { /// /// Returns an error if the password manager is disabled fn get_inner(&self) -> Result, PasswordManagerDisabledError> { - self.inner - .as_ref() - .map(Arc::clone) - .ok_or(PasswordManagerDisabledError) + self.inner.clone().ok_or(PasswordManagerDisabledError) } /// Hash a password with the default hashing scheme. diff --git a/crates/handlers/src/upstream_oauth2/link.rs b/crates/handlers/src/upstream_oauth2/link.rs index 4719e7e2..c51c89a3 100644 --- a/crates/handlers/src/upstream_oauth2/link.rs +++ b/crates/handlers/src/upstream_oauth2/link.rs @@ -76,7 +76,7 @@ pub(crate) enum RouteError { #[error("Template {template:?} rendered to an empty string")] RequiredAttributeEmpty { template: String }, - /// Required claim was missing in id_token + /// Required claim was missing in `id_token` #[error("Template {template:?} could not be rendered from the upstream provider's response for required claim")] RequiredAttributeRender { template: String, diff --git a/crates/i18n/src/translations.rs b/crates/i18n/src/translations.rs index 5a39835a..3fd5584c 100644 --- a/crates/i18n/src/translations.rs +++ b/crates/i18n/src/translations.rs @@ -275,10 +275,7 @@ impl Tree { path: I, ) -> Option<&Node> { let mut iterator = path.into_iter(); - let Some(next) = iterator.next() else { - return None; - }; - + let next = iterator.next()?; self.walk_path_inner(next, iterator) } diff --git a/crates/iana-codegen/src/main.rs b/crates/iana-codegen/src/main.rs index 71e60a2f..39893773 100644 --- a/crates/iana-codegen/src/main.rs +++ b/crates/iana-codegen/src/main.rs @@ -98,6 +98,8 @@ impl Display for File { // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::doc_markdown)] + //! Enums from the {:?} IANA registry //! See <{}> diff --git a/crates/iana/src/jose.rs b/crates/iana/src/jose.rs index 54f3b90f..51b71328 100644 --- a/crates/iana/src/jose.rs +++ b/crates/iana/src/jose.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::doc_markdown)] + //! Enums from the "JSON Object Signing and Encryption" IANA registry //! See diff --git a/crates/iana/src/oauth.rs b/crates/iana/src/oauth.rs index daa3d48a..e6187138 100644 --- a/crates/iana/src/oauth.rs +++ b/crates/iana/src/oauth.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::doc_markdown)] + //! Enums from the "OAuth Parameters" IANA registry //! See diff --git a/crates/listener/src/proxy_protocol/acceptor.rs b/crates/listener/src/proxy_protocol/acceptor.rs index 681a79be..813925a0 100644 --- a/crates/listener/src/proxy_protocol/acceptor.rs +++ b/crates/listener/src/proxy_protocol/acceptor.rs @@ -19,7 +19,7 @@ use tokio::io::{AsyncRead, AsyncReadExt}; use super::ProxyProtocolV1Info; use crate::rewind::Rewind; -#[derive(Clone, Copy, Debug)] +#[derive(Clone, Copy, Debug, Default)] pub struct ProxyAcceptor { _private: (), } diff --git a/crates/matrix-synapse/src/lib.rs b/crates/matrix-synapse/src/lib.rs index adab19fc..3e77e63f 100644 --- a/crates/matrix-synapse/src/lib.rs +++ b/crates/matrix-synapse/src/lib.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::blocks_in_conditions)] + use http::{header::AUTHORIZATION, request::Builder, Method, Request, StatusCode}; use mas_axum_utils::http_client_factory::HttpClientFactory; use mas_http::{EmptyBody, HttpServiceExt}; diff --git a/crates/oidc-client/src/types/scope.rs b/crates/oidc-client/src/types/scope.rs index 0f13c07f..ccc1b7f4 100644 --- a/crates/oidc-client/src/types/scope.rs +++ b/crates/oidc-client/src/types/scope.rs @@ -52,7 +52,7 @@ pub enum ScopeToken { /// `offline_access` /// /// Requests that an OAuth 2.0 refresh token be issued that can be used to - /// obtain an access token that grants access to the end-user's UserInfo + /// obtain an access token that grants access to the end-user's `UserInfo` /// Endpoint even when the end-user is not present (not logged in). OfflineAccess, diff --git a/crates/storage-pg/src/lib.rs b/crates/storage-pg/src/lib.rs index 02cd6766..0294ba79 100644 --- a/crates/storage-pg/src/lib.rs +++ b/crates/storage-pg/src/lib.rs @@ -165,7 +165,7 @@ //! [`Uuid`]: uuid::Uuid #![deny(clippy::future_not_send, missing_docs)] -#![allow(clippy::module_name_repetitions)] +#![allow(clippy::module_name_repetitions, clippy::blocks_in_conditions)] use sqlx::migrate::Migrator; diff --git a/crates/tasks/src/utils.rs b/crates/tasks/src/utils.rs index a607c6af..e64eea64 100644 --- a/crates/tasks/src/utils.rs +++ b/crates/tasks/src/utils.rs @@ -43,10 +43,7 @@ impl TracedJob for JobWithSpanContext { } } -fn make_span_for_job_request(req: &JobRequest) -> tracing::Span -where - J: Job, -{ +fn make_span_for_job_request(req: &JobRequest) -> tracing::Span { let span = info_span!( "job.run", "otel.kind" = "consumer", diff --git a/docs/config.schema.json b/docs/config.schema.json index b3e49021..a97f8020 100644 --- a/docs/config.schema.json +++ b/docs/config.schema.json @@ -633,7 +633,7 @@ } }, "proxy_protocol": { - "description": "Accept HAProxy's Proxy Protocol V1", + "description": "Accept `HAProxy`'s Proxy Protocol V1", "default": false, "type": "boolean" }, @@ -1279,7 +1279,7 @@ ] }, "port": { - "description": "SMTP transport: Port to connect to. Default is 25 for plain, 465 for TLS and 587 for StartTLS", + "description": "SMTP transport: Port to connect to. Default is 25 for plain, 465 for TLS and 587 for `StartTLS`", "type": "integer", "format": "uint16", "maximum": 65535.0, @@ -1337,7 +1337,7 @@ ] }, { - "description": "StartTLS (starts as plain text then upgrade to TLS)", + "description": "`StartTLS` (starts as plain text then upgrade to TLS)", "type": "string", "enum": [ "starttls"