mirror of
https://github.com/dani-garcia/vaultwarden.wiki.git
synced 2026-07-29 13:35:04 +03:00
Switch to Edition 2024, more clippy lints, and less macro calls (#7200)
* Update to Rust 2024 Edition Updated to the Rust 2024 Edition and added and fixed several lint checks. This is a large change which, because of the extra lints, added some possible fixes for issues. Signed-off-by: BlackDex <black.dex@gmail.com> * Reorder and merge imports Signed-off-by: BlackDex <black.dex@gmail.com> * Remove "db_run!" macro calls where possible Signed-off-by: BlackDex <black.dex@gmail.com> --------- Signed-off-by: BlackDex <black.dex@gmail.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
use diesel::connection::{Instrumentation, InstrumentationEvent};
|
||||
use std::{cell::RefCell, collections::HashMap, time::Instant};
|
||||
|
||||
use diesel::connection::{Instrumentation, InstrumentationEvent};
|
||||
|
||||
thread_local! {
|
||||
static QUERY_PERF_TRACKER: RefCell<HashMap<String, Instant>> = RefCell::new(HashMap::new());
|
||||
}
|
||||
@@ -11,7 +12,7 @@ pub fn simple_logger() -> Option<Box<dyn Instrumentation>> {
|
||||
url,
|
||||
..
|
||||
} => {
|
||||
debug!("Establishing connection: {url}")
|
||||
debug!("Establishing connection: {url}");
|
||||
}
|
||||
InstrumentationEvent::FinishEstablishConnection {
|
||||
url,
|
||||
@@ -19,9 +20,9 @@ pub fn simple_logger() -> Option<Box<dyn Instrumentation>> {
|
||||
..
|
||||
} => {
|
||||
if let Some(e) = error {
|
||||
error!("Error during establishing a connection with {url}: {e:?}")
|
||||
error!("Error during establishing a connection with {url}: {e:?}");
|
||||
} else {
|
||||
debug!("Connection established: {url}")
|
||||
debug!("Connection established: {url}");
|
||||
}
|
||||
}
|
||||
InstrumentationEvent::StartQuery {
|
||||
@@ -47,7 +48,7 @@ pub fn simple_logger() -> Option<Box<dyn Instrumentation>> {
|
||||
} else if duration.as_secs() >= 1 {
|
||||
info!("SLOW QUERY [{:.2}s]: {}", duration.as_secs_f32(), query_string);
|
||||
} else {
|
||||
debug!("QUERY [{:?}]: {}", duration, query_string);
|
||||
debug!("QUERY [{duration:?}]: {query_string}");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user