(d8e78cd) Clear the clippy warnings, and bump to 0.8.1
`cargo clippy --all-targets` was reporting 96 warnings, 14 of them in the binary. It is now clean from a cold cache, and the 211 tests still pass. `clippy --fix` took the mechanical ones: needless borrows, `map_or` that is `is_some_and`, `push_str` of a single character, manual `split_once`, and `&PathBuf` parameters in the test fixtures. It also moved the `handlers.rs` test module to the end of the file, which is what `items_after_test_module` was pointing at. Three by hand. `cmd_add` took nine parameters threaded from `main`, and now takes `AddArgs`, which is how `set`, `append` and `check` already pass theirs; the handler destructures it so the body reads as before, and `add --help` is unchanged. The collapsed `if` in `content_trim` needed reindenting, since `--fix` left its body at the old depth. And the two `split_once` rewrites read as `.split_once(..).map(|(_, value)| value)` rather than clippy's `.map(|x| x.1)`. The two eight-argument `create_ticket` test fixtures keep an `allow(too_many_arguments)` carrying the reason: the lint is right that twenty-five positional call sites read as a wall of strings, but replacing them with a named-field struct is a refactor and not a warning sweep. a34a316 tracks it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
6178d7bd3d
commit
8013c2b74d
+20
-18
@@ -189,7 +189,7 @@ pub fn slug(title: &str) -> String {
|
||||
|
||||
pub fn get_git_user() -> Option<String> {
|
||||
std::process::Command::new("git")
|
||||
.args(&["config", "user.name"])
|
||||
.args(["config", "user.name"])
|
||||
.output()
|
||||
.ok()
|
||||
.and_then(|out| {
|
||||
@@ -256,7 +256,7 @@ pub fn resolve_ticket(search: &str, worklane_dir: &Path) -> Result<(String, Stri
|
||||
let entries = fs::read_dir(&status_path)?;
|
||||
for entry in entries.filter_map(|e| e.ok()) {
|
||||
let path = entry.path();
|
||||
if !path.extension().map_or(false, |e| e == "md") {
|
||||
if !path.extension().is_some_and(|e| e == "md") {
|
||||
continue;
|
||||
}
|
||||
let content = match fs::read_to_string(&path) {
|
||||
@@ -326,16 +326,16 @@ pub fn format_comments_with(
|
||||
}
|
||||
|
||||
let mut result = String::new();
|
||||
result.push_str("\n");
|
||||
result.push('\n');
|
||||
result.push_str(&paint("COMMENTS", Color::Orange, colored));
|
||||
result.push_str(&format!("\n{}\n", "─".repeat(20)));
|
||||
|
||||
for (_filename, author, time, body) in comments {
|
||||
result.push_str("\n");
|
||||
result.push('\n');
|
||||
result.push_str(&paint(&format!("From {} ({})", author, time), Color::Cyan, colored));
|
||||
result.push_str("\n");
|
||||
result.push('\n');
|
||||
if !body.is_empty() {
|
||||
result.push_str(&" ".to_string());
|
||||
result.push_str(" ");
|
||||
result.push_str(body);
|
||||
}
|
||||
result.push('\n');
|
||||
@@ -429,17 +429,19 @@ pub fn content_trim(content: &str, colored: bool) -> String {
|
||||
}
|
||||
|
||||
// Standard markdown link colorization in cyan
|
||||
if line.contains("[") && line.contains("(") && line.contains("]") {
|
||||
if let Some(start) = line.find("[") {
|
||||
let bracket_text = &line[start..];
|
||||
if let Some(end_bracket) = bracket_text.find("](") {
|
||||
let link_start = start + end_bracket + 1;
|
||||
if let Some(end) = line[link_start..].find(']') {
|
||||
let absolute_end = link_start + end + 1;
|
||||
result.push_str(&paint(&line[start..absolute_end], Color::Cyan, colored));
|
||||
result.push('\n');
|
||||
continue;
|
||||
}
|
||||
if line.contains("[")
|
||||
&& line.contains("(")
|
||||
&& line.contains("]")
|
||||
&& let Some(start) = line.find("[")
|
||||
{
|
||||
let bracket_text = &line[start..];
|
||||
if let Some(end_bracket) = bracket_text.find("](") {
|
||||
let link_start = start + end_bracket + 1;
|
||||
if let Some(end) = line[link_start..].find(']') {
|
||||
let absolute_end = link_start + end + 1;
|
||||
result.push_str(&paint(&line[start..absolute_end], Color::Cyan, colored));
|
||||
result.push('\n');
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -453,7 +455,7 @@ pub fn content_trim(content: &str, colored: bool) -> String {
|
||||
}
|
||||
|
||||
pub fn colorize_ordered(line: &str) -> String {
|
||||
if line.chars().next().map_or(true, |c| !c.is_ascii_digit()) {
|
||||
if line.chars().next().is_none_or(|c| !c.is_ascii_digit()) {
|
||||
return line.to_string();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user