1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-11-20 12:02:22 +03:00

Fix recently added Clippy lints

This also ignores the clippy::blocks_in_conditions lint in two crates,
until tracing gets fixed: https://github.com/tokio-rs/tracing/issues/2876
This commit is contained in:
Quentin Gliech
2024-05-06 17:51:47 +02:00
parent 3ea24dc8e5
commit 3978acd94e
20 changed files with 31 additions and 57 deletions

View File

@@ -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<String>,
nonce: Option<String>,
#[serde_as(as = "Option<serde_with::TimestampSeconds>")]
auth_time: Option<DateTime<Utc>>,
at_hash: String,
c_hash: String,
}
#[derive(Debug, Error)]
pub(crate) enum RouteError {
#[error(transparent)]

View File

@@ -100,10 +100,7 @@ impl PasswordManager {
///
/// Returns an error if the password manager is disabled
fn get_inner(&self) -> Result<Arc<InnerPasswordManager>, 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.

View File

@@ -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,