ci: add GitHub Actions workflows with semantic-release auto-versioning
chore: fix all 702 clippy warnings across codebase - auto-fix 475 via cargo clippy --fix - fix remaining 227 manually: uninlined_format_args, redundant_closure, match_same_arms, underscore_binding, format_push_string, items_after_statements, needless_pass_by_value, clone_on_copy, case_sensitive_extension, single_match/let-else, write_with_newline, and other clippy lints
This commit is contained in:
+8
-8
@@ -59,10 +59,10 @@ impl Tool for Grep {
|
||||
.to_string();
|
||||
let path = resolve_path(&ctx.workspaces, &rel)?;
|
||||
if !path.exists() {
|
||||
anyhow::bail!("path '{}' does not exist", rel);
|
||||
anyhow::bail!("path '{rel}' does not exist");
|
||||
}
|
||||
if !path.is_dir() {
|
||||
anyhow::bail!("path '{}' is not a directory", rel);
|
||||
anyhow::bail!("path '{rel}' is not a directory");
|
||||
}
|
||||
let mut results: Vec<(String, usize, String)> = Vec::new();
|
||||
for entry in Walk::new(&path).flatten() {
|
||||
@@ -83,10 +83,10 @@ impl Tool for Grep {
|
||||
}
|
||||
}
|
||||
if results.is_empty() {
|
||||
return Ok(format!("no matches found for '{}' in {}", pattern, rel));
|
||||
return Ok(format!("no matches found for '{pattern}' in {rel}"));
|
||||
}
|
||||
let output = results.iter()
|
||||
.map(|(f, line, text)| format!("{}:{}:{}", f, line, text))
|
||||
.map(|(f, line, text)| format!("{f}:{line}:{text}"))
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n");
|
||||
Ok(format!("found {} matches:\n{}", results.len(), output))
|
||||
@@ -144,14 +144,14 @@ impl Tool for Glob {
|
||||
.to_string();
|
||||
let root = resolve_path(&ctx.workspaces, &rel)?;
|
||||
if !root.exists() || !root.is_dir() {
|
||||
anyhow::bail!("path '{}' is not a valid directory", rel);
|
||||
anyhow::bail!("path '{rel}' is not a valid directory");
|
||||
}
|
||||
let mut builder = GlobSetBuilder::new();
|
||||
let full_pattern = root.join(&pat_str).display().to_string();
|
||||
builder.add(GlobBuilder::new(&full_pattern).build()
|
||||
.map_err(|e| anyhow!("invalid glob pattern '{}': {}", pat_str, e))?);
|
||||
.map_err(|e| anyhow!("invalid glob pattern '{pat_str}': {e}"))?);
|
||||
let glob_set = builder.build()
|
||||
.map_err(|e| anyhow!("failed to build glob set: {}", e))?;
|
||||
.map_err(|e| anyhow!("failed to build glob set: {e}"))?;
|
||||
let mut matches: Vec<String> = Vec::new();
|
||||
for entry in Walk::new(&root).flatten() {
|
||||
let p = entry.path();
|
||||
@@ -165,7 +165,7 @@ impl Tool for Glob {
|
||||
}
|
||||
matches.sort();
|
||||
if matches.is_empty() {
|
||||
return Ok(format!("no files match '{}' in {}", pat_str, rel));
|
||||
return Ok(format!("no files match '{pat_str}' in {rel}"));
|
||||
}
|
||||
Ok(matches.join("\n"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user