From bebad3be9b5c13329f7065fbbf3f14cca7031507 Mon Sep 17 00:00:00 2001 From: Radical Date: Tue, 29 Apr 2025 00:43:43 +0200 Subject: [PATCH] style: cargo fmt --- src/api/v1/mod.rs | 5 ++--- src/api/v1/stats.rs | 7 +++++-- src/api/versions.rs | 6 ++---- src/config.rs | 9 ++++----- src/main.rs | 2 +- 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/api/v1/mod.rs b/src/api/v1/mod.rs index 3ff97a9..542a0f5 100644 --- a/src/api/v1/mod.rs +++ b/src/api/v1/mod.rs @@ -1,8 +1,7 @@ -use actix_web::{web, Scope}; +use actix_web::{Scope, web}; mod stats; pub fn web() -> Scope { - web::scope("/v1") - .service(stats::res) + web::scope("/v1").service(stats::res) } diff --git a/src/api/v1/stats.rs b/src/api/v1/stats.rs index 24053bc..f92ed9e 100644 --- a/src/api/v1/stats.rs +++ b/src/api/v1/stats.rs @@ -1,6 +1,6 @@ use std::time::SystemTime; -use actix_web::{get, web, HttpResponse, Responder}; +use actix_web::{HttpResponse, Responder, get, web}; use serde::Serialize; use crate::Data; @@ -19,7 +19,10 @@ struct Response { pub async fn res(data: web::Data) -> impl Responder { let response = Response { accounts: 0, - uptime: SystemTime::now().duration_since(data.start_time).expect("Seriously why dont you have time??").as_secs(), + uptime: SystemTime::now() + .duration_since(data.start_time) + .expect("Seriously why dont you have time??") + .as_secs(), version: String::from(VERSION.unwrap_or("UNKNOWN")), build_number: String::from("how do i implement this?"), }; diff --git a/src/api/versions.rs b/src/api/versions.rs index a7e49b2..fafb824 100644 --- a/src/api/versions.rs +++ b/src/api/versions.rs @@ -1,4 +1,4 @@ -use actix_web::{get, HttpResponse, Responder}; +use actix_web::{HttpResponse, Responder, get}; use serde::Serialize; #[derive(Serialize)] @@ -14,9 +14,7 @@ struct UnstableFeatures; pub async fn res() -> impl Responder { let response = Response { unstable_features: UnstableFeatures, - versions: vec![ - String::from("1"), - ] + versions: vec![String::from("1")], }; HttpResponse::Ok().json(response) diff --git a/src/config.rs b/src/config.rs index a9f720d..cefc272 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,6 +1,6 @@ +use crate::Error; use serde::Deserialize; use tokio::fs::read_to_string; -use crate::Error; #[derive(Debug, Deserialize)] pub struct ConfigBuilder { @@ -14,7 +14,7 @@ pub struct Database { password: String, hostname: String, database: String, - port: u16 + port: u16, } #[derive(Debug, Deserialize)] @@ -34,18 +34,17 @@ impl ConfigBuilder { } pub fn build(self) -> Config { - let web = if let Some(web) = self.web { Web { url: web.url.unwrap_or(String::from("0.0.0.0")), port: web.port.unwrap_or(8080), - ssl: web.ssl.unwrap_or_default() + ssl: web.ssl.unwrap_or_default(), } } else { Web { url: String::from("0.0.0.0"), port: 8080, - ssl: false + ssl: false, } }; diff --git a/src/main.rs b/src/main.rs index 8d1408f..989630c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,5 @@ +use actix_web::{App, HttpServer, web}; use std::time::SystemTime; -use actix_web::{web, App, HttpServer}; mod config; use config::{Config, ConfigBuilder}; mod api;