diff --git a/rust/src/error.rs b/rust/src/error.rs index c12dff1..8c0b575 100644 --- a/rust/src/error.rs +++ b/rust/src/error.rs @@ -73,8 +73,8 @@ impl<'a> AuthError { pub fn to_prom_labels(&'a self) -> Vec<(&'static str, String)> { match self { Self::AuthenticationUserNotFound { username } => vec![("username", username.clone())], - Self::AuthenticationHeaderMissing => vec![], - Self::AuthenticationHeaderInvalid { message: _ } => vec![], + Self::AuthenticationHeaderMissing + | Self::AuthenticationHeaderInvalid { message: _ } => vec![], } } } diff --git a/rust/src/routing/mod.rs b/rust/src/routing/mod.rs index ea6ead2..68d1d4d 100644 --- a/rust/src/routing/mod.rs +++ b/rust/src/routing/mod.rs @@ -51,7 +51,7 @@ where Ok(None) } else { Ok(Some(Uuid::try_from(value).map_err(|e| { - E::custom(format!("UUID parsing failed: {}", e)) + E::custom(format!("UUID parsing failed: {e}")) })?)) } } diff --git a/rust/src/telemetry/tracing/mod.rs b/rust/src/telemetry/tracing/mod.rs index 5008556..bf3c14d 100644 --- a/rust/src/telemetry/tracing/mod.rs +++ b/rust/src/telemetry/tracing/mod.rs @@ -69,7 +69,7 @@ trait Forwarder { fn build( config: Self::Config, - shutdown_functions: &mut Vec Result<(), Box>>>, + shutdown_functions: &mut Vec, ) -> Option>>; } @@ -77,8 +77,8 @@ trait Forwarder { fn get_jaeger_layer< T: tracing::Subscriber + for<'a> tracing_subscriber::registry::LookupSpan<'a>, >( - config: OpenTelemetryConfig, - shutdown_functions: &mut Vec Result<(), Box>>>, + config: &OpenTelemetryConfig, + shutdown_functions: &mut Vec, ) -> Option> { match config { OpenTelemetryConfig::Enabled => { @@ -119,6 +119,8 @@ fn get_jaeger_layer< } } +type ShutdownFunction = Box Result<(), Box>>; + pub async fn init( #[cfg(feature = "jaeger")] opentelemetry_config: OpenTelemetryConfig, #[cfg(feature = "tokio-console")] tokio_console_config: TokioConsoleConfig, @@ -132,13 +134,10 @@ where // mut is dependent on features (it's only required when jaeger is set), so // let's just disable the lint #[cfg(feature = "jaeger")] - let mut shutdown_functions: Vec< - Box Result<(), Box>>, - > = vec![]; + let mut shutdown_functions: Vec = vec![]; #[cfg(not(feature = "jaeger"))] - let shutdown_functions: Vec Result<(), Box>>> = - vec![]; + let shutdown_functions: Vec = vec![]; #[cfg(feature = "tokio-console")] let console_layer = match tokio_console_config { @@ -149,7 +148,7 @@ where let stdout_layer = get_stdout_layer(); #[cfg(feature = "jaeger")] - let jaeger_layer = get_jaeger_layer(opentelemetry_config, &mut shutdown_functions); + let jaeger_layer = get_jaeger_layer(&opentelemetry_config, &mut shutdown_functions); let registry = Registry::default(); diff --git a/rust/src/view/mod.rs b/rust/src/view/mod.rs index f8c68af..f0fb713 100644 --- a/rust/src/view/mod.rs +++ b/rust/src/view/mod.rs @@ -23,7 +23,7 @@ pub enum HtmxAction { impl fmt::Display for HtmxAction { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { - Self::Get(path) => write!(f, "{}", path), + Self::Get(path) => write!(f, "{path}"), } } } @@ -36,7 +36,7 @@ pub enum FallbackAction { impl fmt::Display for FallbackAction { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { - Self::Get(path) => write!(f, "{}", path), + Self::Get(path) => write!(f, "{path}"), } } } @@ -66,9 +66,7 @@ impl ComponentId { let id = &id[..9]; // URL_SAFE because we cannot have slashes in the output - let id = base64::engine::general_purpose::URL_SAFE.encode(id); - - id + base64::engine::general_purpose::URL_SAFE.encode(id) } } diff --git a/rust/src/view/root.rs b/rust/src/view/root.rs index 038579a..549a501 100644 --- a/rust/src/view/root.rs +++ b/rust/src/view/root.rs @@ -161,7 +161,7 @@ impl<'a> Component for Body<'a> { item: TopLevelPage::Inventory, active_page: self.args.active_page } - ).build(&context) + ).build(context) ) ( HeaderLink::init( @@ -170,7 +170,7 @@ impl<'a> Component for Body<'a> { item: TopLevelPage::Trips, active_page: self.args.active_page } - ).build(&context) + ).build(context) ) } a @@ -210,7 +210,7 @@ impl Root { (Body::init(Parent::Root, BodyArgs { body, active_page - }).build(&context)) + }).build(context)) } ) } diff --git a/rust/src/view/trip/mod.rs b/rust/src/view/trip/mod.rs index 110fa83..794b444 100644 --- a/rust/src/view/trip/mod.rs +++ b/rust/src/view/trip/mod.rs @@ -126,7 +126,7 @@ pub struct NewTrip; impl NewTrip { #[tracing::instrument(skip(trips))] - pub fn build(trips: &Vec) -> Markup { + pub fn build(trips: &[models::trips::Trip]) -> Markup { html!( form name="new_trip"