a bit of clippy
This commit is contained in:
@@ -73,8 +73,8 @@ impl<'a> AuthError {
|
|||||||
pub fn to_prom_labels(&'a self) -> Vec<(&'static str, String)> {
|
pub fn to_prom_labels(&'a self) -> Vec<(&'static str, String)> {
|
||||||
match self {
|
match self {
|
||||||
Self::AuthenticationUserNotFound { username } => vec![("username", username.clone())],
|
Self::AuthenticationUserNotFound { username } => vec![("username", username.clone())],
|
||||||
Self::AuthenticationHeaderMissing => vec![],
|
Self::AuthenticationHeaderMissing
|
||||||
Self::AuthenticationHeaderInvalid { message: _ } => vec![],
|
| Self::AuthenticationHeaderInvalid { message: _ } => vec![],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ where
|
|||||||
Ok(None)
|
Ok(None)
|
||||||
} else {
|
} else {
|
||||||
Ok(Some(Uuid::try_from(value).map_err(|e| {
|
Ok(Some(Uuid::try_from(value).map_err(|e| {
|
||||||
E::custom(format!("UUID parsing failed: {}", e))
|
E::custom(format!("UUID parsing failed: {e}"))
|
||||||
})?))
|
})?))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ trait Forwarder {
|
|||||||
|
|
||||||
fn build(
|
fn build(
|
||||||
config: Self::Config,
|
config: Self::Config,
|
||||||
shutdown_functions: &mut Vec<Box<dyn FnOnce() -> Result<(), Box<dyn std::error::Error>>>>,
|
shutdown_functions: &mut Vec<ShutdownFunction>,
|
||||||
) -> Option<Box<dyn tracing_subscriber::Layer<dyn tracing::Subscriber>>>;
|
) -> Option<Box<dyn tracing_subscriber::Layer<dyn tracing::Subscriber>>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,8 +77,8 @@ trait Forwarder {
|
|||||||
fn get_jaeger_layer<
|
fn get_jaeger_layer<
|
||||||
T: tracing::Subscriber + for<'a> tracing_subscriber::registry::LookupSpan<'a>,
|
T: tracing::Subscriber + for<'a> tracing_subscriber::registry::LookupSpan<'a>,
|
||||||
>(
|
>(
|
||||||
config: OpenTelemetryConfig,
|
config: &OpenTelemetryConfig,
|
||||||
shutdown_functions: &mut Vec<Box<dyn FnOnce() -> Result<(), Box<dyn std::error::Error>>>>,
|
shutdown_functions: &mut Vec<ShutdownFunction>,
|
||||||
) -> Option<impl tracing_subscriber::Layer<T>> {
|
) -> Option<impl tracing_subscriber::Layer<T>> {
|
||||||
match config {
|
match config {
|
||||||
OpenTelemetryConfig::Enabled => {
|
OpenTelemetryConfig::Enabled => {
|
||||||
@@ -119,6 +119,8 @@ fn get_jaeger_layer<
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ShutdownFunction = Box<dyn FnOnce() -> Result<(), Box<dyn std::error::Error>>>;
|
||||||
|
|
||||||
pub async fn init<Func, T>(
|
pub async fn init<Func, T>(
|
||||||
#[cfg(feature = "jaeger")] opentelemetry_config: OpenTelemetryConfig,
|
#[cfg(feature = "jaeger")] opentelemetry_config: OpenTelemetryConfig,
|
||||||
#[cfg(feature = "tokio-console")] tokio_console_config: TokioConsoleConfig,
|
#[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
|
// mut is dependent on features (it's only required when jaeger is set), so
|
||||||
// let's just disable the lint
|
// let's just disable the lint
|
||||||
#[cfg(feature = "jaeger")]
|
#[cfg(feature = "jaeger")]
|
||||||
let mut shutdown_functions: Vec<
|
let mut shutdown_functions: Vec<ShutdownFunction> = vec![];
|
||||||
Box<dyn FnOnce() -> Result<(), Box<dyn std::error::Error>>>,
|
|
||||||
> = vec![];
|
|
||||||
|
|
||||||
#[cfg(not(feature = "jaeger"))]
|
#[cfg(not(feature = "jaeger"))]
|
||||||
let shutdown_functions: Vec<Box<dyn FnOnce() -> Result<(), Box<dyn std::error::Error>>>> =
|
let shutdown_functions: Vec<ShutdownFunction> = vec![];
|
||||||
vec![];
|
|
||||||
|
|
||||||
#[cfg(feature = "tokio-console")]
|
#[cfg(feature = "tokio-console")]
|
||||||
let console_layer = match tokio_console_config {
|
let console_layer = match tokio_console_config {
|
||||||
@@ -149,7 +148,7 @@ where
|
|||||||
let stdout_layer = get_stdout_layer();
|
let stdout_layer = get_stdout_layer();
|
||||||
|
|
||||||
#[cfg(feature = "jaeger")]
|
#[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();
|
let registry = Registry::default();
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ pub enum HtmxAction {
|
|||||||
impl fmt::Display for HtmxAction {
|
impl fmt::Display for HtmxAction {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
match self {
|
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 {
|
impl fmt::Display for FallbackAction {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
Self::Get(path) => write!(f, "{}", path),
|
Self::Get(path) => write!(f, "{path}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -66,9 +66,7 @@ impl ComponentId {
|
|||||||
let id = &id[..9];
|
let id = &id[..9];
|
||||||
|
|
||||||
// URL_SAFE because we cannot have slashes in the output
|
// URL_SAFE because we cannot have slashes in the output
|
||||||
let id = base64::engine::general_purpose::URL_SAFE.encode(id);
|
base64::engine::general_purpose::URL_SAFE.encode(id)
|
||||||
|
|
||||||
id
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ impl<'a> Component for Body<'a> {
|
|||||||
item: TopLevelPage::Inventory,
|
item: TopLevelPage::Inventory,
|
||||||
active_page: self.args.active_page
|
active_page: self.args.active_page
|
||||||
}
|
}
|
||||||
).build(&context)
|
).build(context)
|
||||||
)
|
)
|
||||||
(
|
(
|
||||||
HeaderLink::init(
|
HeaderLink::init(
|
||||||
@@ -170,7 +170,7 @@ impl<'a> Component for Body<'a> {
|
|||||||
item: TopLevelPage::Trips,
|
item: TopLevelPage::Trips,
|
||||||
active_page: self.args.active_page
|
active_page: self.args.active_page
|
||||||
}
|
}
|
||||||
).build(&context)
|
).build(context)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
a
|
a
|
||||||
@@ -210,7 +210,7 @@ impl Root {
|
|||||||
(Body::init(Parent::Root, BodyArgs {
|
(Body::init(Parent::Root, BodyArgs {
|
||||||
body,
|
body,
|
||||||
active_page
|
active_page
|
||||||
}).build(&context))
|
}).build(context))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ pub struct NewTrip;
|
|||||||
|
|
||||||
impl NewTrip {
|
impl NewTrip {
|
||||||
#[tracing::instrument(skip(trips))]
|
#[tracing::instrument(skip(trips))]
|
||||||
pub fn build(trips: &Vec<models::trips::Trip>) -> Markup {
|
pub fn build(trips: &[models::trips::Trip]) -> Markup {
|
||||||
html!(
|
html!(
|
||||||
form
|
form
|
||||||
name="new_trip"
|
name="new_trip"
|
||||||
|
|||||||
Reference in New Issue
Block a user