aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-03-05 05:59:27 -0800
committerFuwn <[email protected]>2024-03-05 05:59:27 -0800
commit30f80c85b9ed4cb6a4a633e1bc7a3dbd142f8547 (patch)
tree53433b0acade861f6d5e8f8a308d6208199d5ce2
parentci(earthly): switch to earthly from docker (diff)
downloadlocus-30f80c85b9ed4cb6a4a633e1bc7a3dbd142f8547.tar.xz
locus-30f80c85b9ed4cb6a4a633e1bc7a3dbd142f8547.zip
format: new rustfmt.toml
-rw-r--r--amenadiel/src/lib.rs4
-rw-r--r--rustfmt.toml19
-rw-r--r--src/main.rs12
-rw-r--r--src/response.rs4
-rw-r--r--src/route.rs9
-rw-r--r--src/timing.rs4
-rw-r--r--src/xml.rs6
7 files changed, 22 insertions, 36 deletions
diff --git a/amenadiel/src/lib.rs b/amenadiel/src/lib.rs
index 4e316f8..99e6d45 100644
--- a/amenadiel/src/lib.rs
+++ b/amenadiel/src/lib.rs
@@ -26,9 +26,7 @@
#![deny(clippy::all, clippy::nursery, clippy::pedantic)]
#![recursion_limit = "128"]
-use proc_macro::TokenStream;
-use quote::quote;
-use syn::Ident;
+use {proc_macro::TokenStream, quote::quote, syn::Ident};
/// Legitimise and mount Locus modules
///
diff --git a/rustfmt.toml b/rustfmt.toml
index dab6ef1..27653e1 100644
--- a/rustfmt.toml
+++ b/rustfmt.toml
@@ -1,27 +1,24 @@
-condense_wildcard_suffixes = true
edition = "2021"
-enum_discrim_align_threshold = 20
+enum_discrim_align_threshold = 40
# error_on_line_overflow = true
# error_on_unformatted = true
fn_single_line = true
-force_multiline_blocks = true
format_code_in_doc_comments = true
format_macro_matchers = true
format_strings = true
-imports_layout = "HorizontalVertical"
-max_width = 80
+inline_attribute_width = 80
match_arm_blocks = false
-imports_granularity = "Crate"
+max_width = 80
+imports_granularity = "One"
newline_style = "Unix"
-normalize_comments = true
normalize_doc_attributes = true
+overflow_delimited_expr = true
reorder_impl_items = true
group_imports = "StdExternalCrate"
-reorder_modules = true
-struct_field_align_threshold = 20
-struct_lit_single_line = false
+struct_field_align_threshold = 40
tab_spaces = 2
use_field_init_shorthand = true
+use_small_heuristics = "Max"
use_try_shorthand = true
-where_single_line = true
+version = "Two"
wrap_comments = true
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!(
diff --git a/src/xml.rs b/src/xml.rs
index 7bc40e6..dc60a49 100644
--- a/src/xml.rs
+++ b/src/xml.rs
@@ -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());