From 14ec768b4520d4fc34dbf24e663ea7db940c18b7 Mon Sep 17 00:00:00 2001 From: Ellie Huxtable Date: Wed, 19 Mar 2025 12:44:20 +0000 Subject: chore: migrate to rust 2024 (#2635) * chore: upgrade to 2024 edition * ugh unsafe * format * nixxxxxxxxxxx why --- crates/atuin-server/src/handlers/user.rs | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'crates/atuin-server/src/handlers/user.rs') diff --git a/crates/atuin-server/src/handlers/user.rs b/crates/atuin-server/src/handlers/user.rs index 50defc4a..135b0e0d 100644 --- a/crates/atuin-server/src/handlers/user.rs +++ b/crates/atuin-server/src/handlers/user.rs @@ -3,17 +3,17 @@ use std::collections::HashMap; use std::time::Duration; use argon2::{ - password_hash::SaltString, Algorithm, Argon2, Params, PasswordHash, PasswordHasher, - PasswordVerifier, Version, + Algorithm, Argon2, Params, PasswordHash, PasswordHasher, PasswordVerifier, Version, + password_hash::SaltString, }; use axum::{ + Json, extract::{Path, State}, http::StatusCode, - Json, }; use metrics::counter; -use postmark::{reqwest::PostmarkClient, Query}; +use postmark::{Query, reqwest::PostmarkClient}; use rand::rngs::OsRng; use tracing::{debug, error, info, instrument}; @@ -21,8 +21,8 @@ use tracing::{debug, error, info, instrument}; use super::{ErrorResponse, ErrorResponseStatus, RespExt}; use crate::router::{AppState, UserAuth}; use atuin_server_database::{ - models::{NewSession, NewUser}, Database, DbError, + models::{NewSession, NewUser}, }; use reqwest::header::CONTENT_TYPE; @@ -104,7 +104,7 @@ pub async fn register( return Err(ErrorResponse::reply( "Only alphanumeric and hyphens (-) are allowed in usernames", ) - .with_status(StatusCode::BAD_REQUEST)) + .with_status(StatusCode::BAD_REQUEST)); } } } @@ -201,12 +201,13 @@ pub async fn send_verification( } // TODO: if we ever add another mail provider, can match on them all here. - let postmark_token = if let Some(token) = settings.mail.postmark.token { - token - } else { - error!("Failed to verify email: got None for postmark token"); - return Err(ErrorResponse::reply("mail not configured") - .with_status(StatusCode::INTERNAL_SERVER_ERROR)); + let postmark_token = match settings.mail.postmark.token { + Some(token) => token, + _ => { + error!("Failed to verify email: got None for postmark token"); + return Err(ErrorResponse::reply("mail not configured") + .with_status(StatusCode::INTERNAL_SERVER_ERROR)); + } }; let db = &state.0.database; -- cgit v1.3.1