mirror of
https://github.com/perstarkse/minne.git
synced 2026-11-19 21:39:47 +01:00
clippy: adhere to pedantic clippy, uniform test error handling
This commit is contained in:
1 parent
e0068ebe26
commit
5ce7a76c75
68 files changed
+2468
-2547
No files matched your search
@@ -6,19 +6,19 @@ use axum::{
|
||||
|
||||
use common::storage::types::user::User;
|
||||
|
||||
use crate::{api_state::ApiState, error::ApiError};
|
||||
use crate::{api_state::ApiState, error::ApiErr};
|
||||
|
||||
pub async fn api_auth(
|
||||
State(state): State<ApiState>,
|
||||
mut request: Request,
|
||||
next: Next,
|
||||
) -> Result<Response, ApiError> {
|
||||
) -> Result<Response, ApiErr> {
|
||||
let api_key = extract_api_key(&request)
|
||||
.ok_or_else(|| ApiError::Unauthorized("You have to be authenticated".to_string()))?;
|
||||
.ok_or_else(|| ApiErr::Unauthorized("You have to be authenticated".to_string()))?;
|
||||
|
||||
let user = User::find_by_api_key(&api_key, &state.db).await?;
|
||||
let user =
|
||||
user.ok_or_else(|| ApiError::Unauthorized("You have to be authenticated".to_string()))?;
|
||||
user.ok_or_else(|| ApiErr::Unauthorized("You have to be authenticated".to_string()))?;
|
||||
|
||||
request.extensions_mut().insert(user);
|
||||
|
||||
|
||||
Reference in new issue
Block a user