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

handlers: extract the PgRepository from the request

Also fix a bunch of clippy errors & doctests
This commit is contained in:
Quentin Gliech
2023-01-18 18:21:45 +01:00
parent 9005931e2a
commit 876bc9fcb3
29 changed files with 79 additions and 142 deletions

View File

@@ -21,7 +21,10 @@
)]
#![warn(clippy::pedantic)]
#![allow(
clippy::unused_async // Some axum handlers need that
// Some axum handlers need that
clippy::unused_async,
// Because of how axum handlers work, we sometime have take many arguments
clippy::too_many_arguments,
)]
use std::{convert::Infallible, sync::Arc, time::Duration};
@@ -41,6 +44,7 @@ use mas_keystore::{Encrypter, Keystore};
use mas_policy::PolicyFactory;
use mas_router::{Route, UrlBuilder};
use mas_storage::{BoxClock, BoxRng};
use mas_storage_pg::PgRepository;
use mas_templates::{ErrorContext, Templates};
use passwords::PasswordManager;
use sqlx::PgPool;
@@ -154,7 +158,7 @@ where
Keystore: FromRef<S>,
UrlBuilder: FromRef<S>,
Arc<PolicyFactory>: FromRef<S>,
PgPool: FromRef<S>,
PgRepository: FromRequestParts<S>,
Encrypter: FromRef<S>,
HttpClientFactory: FromRef<S>,
BoxClock: FromRequestParts<S>,
@@ -209,7 +213,7 @@ where
<B as HttpBody>::Error: std::error::Error + Send + Sync,
S: Clone + Send + Sync + 'static,
UrlBuilder: FromRef<S>,
PgPool: FromRef<S>,
PgRepository: FromRequestParts<S>,
MatrixHomeserver: FromRef<S>,
PasswordManager: FromRef<S>,
BoxClock: FromRequestParts<S>,
@@ -254,7 +258,7 @@ where
S: Clone + Send + Sync + 'static,
UrlBuilder: FromRef<S>,
Arc<PolicyFactory>: FromRef<S>,
PgPool: FromRef<S>,
PgRepository: FromRequestParts<S>,
Encrypter: FromRef<S>,
Templates: FromRef<S>,
Mailer: FromRef<S>,
@@ -358,7 +362,7 @@ where
}
#[cfg(test)]
async fn test_state(pool: PgPool) -> Result<AppState, anyhow::Error> {
async fn test_state(pool: sqlx::PgPool) -> Result<AppState, anyhow::Error> {
use mas_email::MailTransport;
use crate::passwords::Hasher;