From 93544c3eefa4a3087a40b1c5c083cd0298b6b480 Mon Sep 17 00:00:00 2001 From: Chris Beck Date: Thu, 18 Dec 2025 14:07:17 -0700 Subject: [PATCH] fix clippies --- signal-gateway-code-tool/src/cached.rs | 5 ++--- signal-gateway-log-ingest/src/path_prefix.rs | 5 +++-- signal-gateway/src/gateway/mod.rs | 9 ++++++--- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/signal-gateway-code-tool/src/cached.rs b/signal-gateway-code-tool/src/cached.rs index cbc1017..868b111 100644 --- a/signal-gateway-code-tool/src/cached.rs +++ b/signal-gateway-code-tool/src/cached.rs @@ -208,11 +208,10 @@ fn extract_files( } // Apply glob filter if configured - if let Some(glob_filter) = glob_filter { - if !glob_filter.is_match(&path) { + if let Some(glob_filter) = glob_filter + && !glob_filter.is_match(&path) { continue; } - } // Read file contents let mut contents = Vec::new(); diff --git a/signal-gateway-log-ingest/src/path_prefix.rs b/signal-gateway-log-ingest/src/path_prefix.rs index 7209ed7..0472702 100644 --- a/signal-gateway-log-ingest/src/path_prefix.rs +++ b/signal-gateway-log-ingest/src/path_prefix.rs @@ -75,6 +75,7 @@ impl PathPrefixFinder for Finder { } } +#[allow(clippy::enum_variant_names)] #[derive(Clone)] enum FinderInner { LeadingDoubleStar { @@ -118,7 +119,7 @@ impl FinderInner { "** must be followed by / or end of string" ); let lits = rem.find(META).unwrap_or(rem.len()); - let rneedle = (&rem[..lits]).to_owned().into_boxed_str(); + let rneedle = rem[..lits].to_owned().into_boxed_str(); let child = Some(Box::new(Self::new(&rem[lits..]))); Self::LeadingDoubleStar { rneedle, child } } else { @@ -130,7 +131,7 @@ impl FinderInner { ); let pref = &pattern[..star2_idx]; let st = pref.rfind(META).map(|i| i + 1).unwrap_or(0); - let needle = (&pref[st..]).to_owned().into_boxed_str(); + let needle = pref[st..].to_owned().into_boxed_str(); let left_child = Box::new(Self::new(&pref[..st])); let right_child = Box::new(Self::new(&pattern[star2_idx..])); Self::MidDoubleStar { diff --git a/signal-gateway/src/gateway/mod.rs b/signal-gateway/src/gateway/mod.rs index 210efee..38960ab 100644 --- a/signal-gateway/src/gateway/mod.rs +++ b/signal-gateway/src/gateway/mod.rs @@ -261,13 +261,16 @@ pub struct Gateway { /// Additional tool executors added via the builder. extra_tool_executors: Vec>, /// Path normalization function - path_normalization_fn: Option &str + Send + Sync>>, + path_normalization_fn: Option, } /// Type alias for the assistant factory function. pub type AssistantFactory = Box) -> Box + Send>; +/// Type alias for the path normalization function. +pub type PathNormFn = Box &str + Send + Sync>; + /// Builder for creating a [`Gateway`] with optional additional tool executors. pub struct GatewayBuilder { config: GatewayConfig, @@ -275,7 +278,7 @@ pub struct GatewayBuilder { command_router: Option, extra_tool_executors: Vec>, assistant_factory: Option, - path_normalization_fn: Option &str + Send + Sync>>, + path_normalization_fn: Option, } impl GatewayBuilder { @@ -360,7 +363,7 @@ impl Gateway { command_router: CommandRouter, extra_tool_executors: Vec>, assistant_factory: Option, - path_normalization_fn: Option &str + Send + Sync>>, + path_normalization_fn: Option, ) -> Arc { let child_token = token.child_token(); let (signal_alert_mq_tx, signal_alert_mq_rx) = unbounded_channel();