fix: add --all to cargo fmt in script/test and autoformat codebase

cargo fmt without --all fails with "Failed to find targets" in
workspace repos. This was blocking every story's gates. Also ran
cargo fmt --all to fix all existing formatting issues.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
dave
2026-04-13 14:07:08 +00:00
parent ed2526ce41
commit 845b85e7a7
128 changed files with 3566 additions and 2395 deletions
+41 -16
View File
@@ -55,7 +55,12 @@ pub struct LogEntry {
impl LogEntry {
/// Format the entry as a single log line: `{timestamp} [{LEVEL}] {message}`.
pub fn formatted(&self) -> String {
format!("{} [{}] {}", self.timestamp, self.level.as_str(), self.message)
format!(
"{} [{}] {}",
self.timestamp,
self.level.as_str(),
self.message
)
}
/// Format with ANSI color codes for terminal output.
@@ -146,7 +151,8 @@ impl LogBuffer {
.iter()
.filter(|entry| {
severity.is_none_or(|s| &entry.level == s)
&& filter.is_none_or(|f| entry.message.contains(f) || entry.formatted().contains(f))
&& filter
.is_none_or(|f| entry.message.contains(f) || entry.formatted().contains(f))
})
.map(|entry| entry.formatted())
.collect();
@@ -171,7 +177,8 @@ impl LogBuffer {
.iter()
.filter(|entry| {
severity.is_none_or(|s| &entry.level == s)
&& filter.is_none_or(|f| entry.message.contains(f) || entry.formatted().contains(f))
&& filter
.is_none_or(|f| entry.message.contains(f) || entry.formatted().contains(f))
})
.cloned()
.collect();
@@ -255,11 +262,17 @@ mod tests {
// Should have exactly CAPACITY lines
assert_eq!(recent.len(), CAPACITY);
// The oldest (line 0) should have been evicted
assert!(!recent.iter().any(|l| l.contains("line 0") && !l.contains("line 10")));
assert!(
!recent
.iter()
.any(|l| l.contains("line 0") && !l.contains("line 10"))
);
// The newest should be present
assert!(recent
.iter()
.any(|l| l.contains(&format!("line {CAPACITY}"))));
assert!(
recent
.iter()
.any(|l| l.contains(&format!("line {CAPACITY}")))
);
}
#[test]
@@ -303,10 +316,7 @@ mod tests {
assert_eq!(recent.len(), 1);
// Timestamp format: YYYY-MM-DDTHH:MM:SSZ
let line = &recent[0];
assert!(
line.len() > 20,
"Line should have timestamp prefix: {line}"
);
assert!(line.len() > 20, "Line should have timestamp prefix: {line}");
// Check it starts with a 4-digit year
assert!(line.chars().next().unwrap().is_ascii_digit());
assert!(line.contains('T'));
@@ -372,8 +382,14 @@ mod tests {
message: "test warning".into(),
};
let colored = entry.colored_formatted();
assert!(colored.starts_with("\x1b[33m"), "WARN should start with yellow ANSI code");
assert!(colored.ends_with("\x1b[0m"), "WARN should end with ANSI reset");
assert!(
colored.starts_with("\x1b[33m"),
"WARN should start with yellow ANSI code"
);
assert!(
colored.ends_with("\x1b[0m"),
"WARN should end with ANSI reset"
);
assert!(colored.contains("[WARN]"));
assert!(colored.contains("test warning"));
}
@@ -386,8 +402,14 @@ mod tests {
message: "test error".into(),
};
let colored = entry.colored_formatted();
assert!(colored.starts_with("\x1b[31m"), "ERROR should start with red ANSI code");
assert!(colored.ends_with("\x1b[0m"), "ERROR should end with ANSI reset");
assert!(
colored.starts_with("\x1b[31m"),
"ERROR should start with red ANSI code"
);
assert!(
colored.ends_with("\x1b[0m"),
"ERROR should end with ANSI reset"
);
assert!(colored.contains("[ERROR]"));
assert!(colored.contains("test error"));
}
@@ -400,7 +422,10 @@ mod tests {
message: "test info".into(),
};
let colored = entry.colored_formatted();
assert!(!colored.contains("\x1b["), "INFO should have no ANSI escape codes");
assert!(
!colored.contains("\x1b["),
"INFO should have no ANSI escape codes"
);
assert!(colored.contains("[INFO]"));
assert!(colored.contains("test info"));
}