fmt: cleanup & cargo fmt

This commit is contained in:
Patrick Michl 2022-04-25 22:03:25 +02:00
parent b8e1235396
commit 2c91e99a4d
5 changed files with 11 additions and 11 deletions

View File

@ -67,14 +67,14 @@ impl IntoResponse for ApiError {
StatusCode::UNAUTHORIZED, StatusCode::UNAUTHORIZED,
Json(RegistrationResponse::user_interactive_authorization_info()), Json(RegistrationResponse::user_interactive_authorization_info()),
).into_response(), ).into_response(),
RegistrationError::InvalidUserId => (StatusCode::OK, Json( RegistrationError::InvalidUserId | RegistrationError::MissingUserId => (
ErrorResponse::new( StatusCode::BAD_REQUEST,
Json(ErrorResponse::new(
ErrorCode::InvalidUsername, ErrorCode::InvalidUsername,
&registration_error.to_string(), &registration_error.to_string(),
None, None,
) )
)).into_response(), )).into_response(),
RegistrationError::MissingUserId => (StatusCode::OK, String::new()).into_response(),
RegistrationError::UserIdTaken => ( RegistrationError::UserIdTaken => (
StatusCode::BAD_REQUEST, StatusCode::BAD_REQUEST,
Json(ErrorResponse::new( Json(ErrorResponse::new(

View File

@ -1,3 +1,3 @@
pub mod auth; pub mod auth;
pub mod versions;
pub mod errors; pub mod errors;
pub mod versions;

View File

@ -35,7 +35,7 @@ impl Default for Config {
} }
#[tokio::main] #[tokio::main]
async fn main() { async fn main() -> anyhow::Result<()> {
if std::env::var("RUST_LOG").is_err() { if std::env::var("RUST_LOG").is_err() {
std::env::set_var("RUST_LOG", "debug"); std::env::set_var("RUST_LOG", "debug");
} }
@ -44,9 +44,7 @@ async fn main() {
let config = Arc::new(Config::default()); let config = Arc::new(Config::default());
let pool = sqlx::SqlitePool::connect(&config.db_path) let pool = sqlx::SqlitePool::connect(&config.db_path).await?;
.await
.unwrap();
let cors = CorsLayer::new() let cors = CorsLayer::new()
.allow_origin(tower_http::cors::Any) .allow_origin(tower_http::cors::Any)
@ -69,7 +67,9 @@ async fn main() {
let _ = axum::Server::bind(&"127.0.0.1:3000".parse().unwrap()) let _ = axum::Server::bind(&"127.0.0.1:3000".parse().unwrap())
.serve(router.into_make_service()) .serve(router.into_make_service())
.await; .await?;
Ok(())
} }
async fn fallback(request: Request<Body>) -> StatusCode { async fn fallback(request: Request<Body>) -> StatusCode {

View File

@ -1,7 +1,7 @@
pub mod authentication_data; pub mod authentication_data;
pub mod error_code;
pub mod flow; pub mod flow;
pub mod identifier; pub mod identifier;
pub mod identifier_type; pub mod identifier_type;
pub mod matrix_user_id; pub mod matrix_user_id;
pub mod user_interactive_authorization; pub mod user_interactive_authorization;
pub mod error_code;