diff options
| author | Fuwn <[email protected]> | 2024-03-05 05:59:27 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-03-05 05:59:27 -0800 |
| commit | 30f80c85b9ed4cb6a4a633e1bc7a3dbd142f8547 (patch) | |
| tree | 53433b0acade861f6d5e8f8a308d6208199d5ce2 /src | |
| parent | ci(earthly): switch to earthly from docker (diff) | |
| download | locus-30f80c85b9ed4cb6a4a633e1bc7a3dbd142f8547.tar.xz locus-30f80c85b9ed4cb6a4a633e1bc7a3dbd142f8547.zip | |
format: new rustfmt.toml
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.rs | 12 | ||||
| -rw-r--r-- | src/response.rs | 4 | ||||
| -rw-r--r-- | src/route.rs | 9 | ||||
| -rw-r--r-- | src/timing.rs | 4 | ||||
| -rw-r--r-- | src/xml.rs | 6 |
5 files changed, 13 insertions, 22 deletions
diff --git a/src/main.rs b/src/main.rs index 9d623f3..447e37e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -35,13 +35,13 @@ mod route; mod timing; mod xml; -#[macro_use] -extern crate log; +#[macro_use] extern crate log; -use std::sync::{LazyLock, Mutex}; - -use pickledb::PickleDb; -use tokio::time::Instant; +use { + pickledb::PickleDb, + std::sync::{LazyLock, Mutex}, + tokio::time::Instant, +}; const ERROR_HANDLER_RESPONSE: &str = "The requested resource could not be found at this time. You can try \ diff --git a/src/response.rs b/src/response.rs index b9aa96b..c6df182 100644 --- a/src/response.rs +++ b/src/response.rs @@ -15,9 +15,7 @@ // Copyright (C) 2022-2023 Fuwn <[email protected]> // SPDX-License-Identifier: GPL-3.0-only -use std::sync::LazyLock; - -use windmark::response::Response; +use {std::sync::LazyLock, windmark::response::Response}; static QUOTES: LazyLock<Vec<String>> = LazyLock::new(|| { serde_json::from_str(include_str!("../content/json/quotes.json")).unwrap() diff --git a/src/route.rs b/src/route.rs index 8d7695d..27cdc0f 100644 --- a/src/route.rs +++ b/src/route.rs @@ -37,18 +37,13 @@ pub struct Route { } impl Route { pub fn new(description: &str) -> Self { - Self { - description: description.to_string(), - text_cache: String::new(), - } + Self { description: description.to_string(), text_cache: String::new() } } } pub fn hits_from(route: &str) -> i32 { crate::DATABASE.lock().map_or(0, |database| { - (*database) - .get::<i32>(if route.is_empty() { "/" } else { route }) - .unwrap() + (*database).get::<i32>(if route.is_empty() { "/" } else { route }).unwrap() }) } diff --git a/src/timing.rs b/src/timing.rs index 40f7a13..9a56238 100644 --- a/src/timing.rs +++ b/src/timing.rs @@ -19,7 +19,9 @@ use tokio::time::Instant; pub fn time_mounts<T>(context: &str, timer: &mut Instant, mut mounter: T) -where T: FnMut() { +where + T: FnMut(), +{ mounter(); info!( @@ -25,11 +25,7 @@ pub struct Item { fields: HashMap<String, String>, } impl Item { - pub fn builder() -> Self { - Self { - fields: HashMap::new(), - } - } + pub fn builder() -> Self { Self { fields: HashMap::new() } } pub fn add_field(&mut self, key: &str, value: &str) -> &mut Self { self.fields.insert(key.to_string(), value.to_string()); |