fix clippies
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -261,13 +261,16 @@ pub struct Gateway {
|
||||
/// Additional tool executors added via the builder.
|
||||
extra_tool_executors: Vec<Arc<dyn ToolExecutor>>,
|
||||
/// Path normalization function
|
||||
path_normalization_fn: Option<Box<dyn Fn(&str) -> &str + Send + Sync>>,
|
||||
path_normalization_fn: Option<PathNormFn>,
|
||||
}
|
||||
|
||||
/// Type alias for the assistant factory function.
|
||||
pub type AssistantFactory =
|
||||
Box<dyn FnOnce(Weak<dyn ToolExecutor>) -> Box<dyn crate::assistant::Assistant> + Send>;
|
||||
|
||||
/// Type alias for the path normalization function.
|
||||
pub type PathNormFn = Box<dyn Fn(&str) -> &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<CommandRouter>,
|
||||
extra_tool_executors: Vec<Arc<dyn ToolExecutor>>,
|
||||
assistant_factory: Option<AssistantFactory>,
|
||||
path_normalization_fn: Option<Box<dyn Fn(&str) -> &str + Send + Sync>>,
|
||||
path_normalization_fn: Option<PathNormFn>,
|
||||
}
|
||||
|
||||
impl GatewayBuilder {
|
||||
@@ -360,7 +363,7 @@ impl Gateway {
|
||||
command_router: CommandRouter,
|
||||
extra_tool_executors: Vec<Arc<dyn ToolExecutor>>,
|
||||
assistant_factory: Option<AssistantFactory>,
|
||||
path_normalization_fn: Option<Box<dyn Fn(&str) -> &str + Send + Sync>>,
|
||||
path_normalization_fn: Option<PathNormFn>,
|
||||
) -> Arc<Self> {
|
||||
let child_token = token.child_token();
|
||||
let (signal_alert_mq_tx, signal_alert_mq_rx) = unbounded_channel();
|
||||
|
||||
Reference in New Issue
Block a user