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:
@@ -12,8 +12,8 @@ use anyhow::{Result, anyhow};
|
||||
pub fn arg_str(args: &Value, name: &str) -> Result<String> {
|
||||
args.get(name)
|
||||
.and_then(|v| v.as_str())
|
||||
.map(|s| s.to_string())
|
||||
.ok_or_else(|| anyhow!("missing required argument: {}", name))
|
||||
.map(std::string::ToString::to_string)
|
||||
.ok_or_else(|| anyhow!("missing required argument: {name}"))
|
||||
}
|
||||
|
||||
/// Produce a user-friendly diagnostic string when a path doesn't resolve or exist.
|
||||
@@ -25,17 +25,17 @@ pub fn arg_str(args: &Value, name: &str) -> Result<String> {
|
||||
pub fn not_found_help(ctx: &super::super::ToolCtx, path: &Path, rel: &str) -> String {
|
||||
let canon = path.canonicalize().unwrap_or_else(|_| path.to_path_buf());
|
||||
let in_ws = ctx.workspaces.iter().any(|w| {
|
||||
let wc = w.canonicalize().unwrap_or_else(|_| w.to_path_buf());
|
||||
let wc = w.canonicalize().unwrap_or_else(|_| w.clone());
|
||||
canon.starts_with(&wc)
|
||||
});
|
||||
if !in_ws {
|
||||
if in_ws {
|
||||
format!("path '{}' does not exist (resolved to {})", rel, canon.display())
|
||||
} else {
|
||||
format!(
|
||||
"path '{}' is outside all workspace roots. Workspace roots: {}",
|
||||
rel,
|
||||
ctx.workspaces.iter().map(|w| w.display().to_string()).collect::<Vec<_>>().join(", ")
|
||||
)
|
||||
} else {
|
||||
format!("path '{}' does not exist (resolved to {})", rel, canon.display())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user