style: cargo fmt on today's new code (883/884/886/opus-pin)
The mergemaster gates run rustfmt and rejected 864's merge because several files I added/touched in master today had not been fmt'd. Six files affected, mostly trivial line-wrapping nits. Fixes the formatting gate for the next 864 merge attempt.
This commit is contained in:
@@ -8,12 +8,12 @@
|
||||
|
||||
/// Side-effectful shell I/O — filesystem permission checks.
|
||||
pub mod io;
|
||||
/// Pure command-safety checks, blocked-binary lists, and output truncation.
|
||||
pub mod path_guard;
|
||||
/// Cargo / rustc diagnostic parser — extracts structured errors and warnings
|
||||
/// from raw cargo output. Used by run_check / run_build / run_lint MCP tools
|
||||
/// (bug 886).
|
||||
pub mod parse_diagnostics;
|
||||
/// Pure command-safety checks, blocked-binary lists, and output truncation.
|
||||
pub mod path_guard;
|
||||
|
||||
#[allow(unused_imports)]
|
||||
pub use path_guard::{
|
||||
|
||||
@@ -59,8 +59,8 @@ pub fn parse_diagnostics(output: &str) -> Vec<Diagnostic> {
|
||||
// Anchored to start-of-line: "error" or "warning", optional [CODE], colon, message.
|
||||
Regex::new(r"^(error|warning)(?:\[([A-Za-z0-9]+)\])?: (.+)$").unwrap()
|
||||
});
|
||||
let loc_re = LOC_RE
|
||||
.get_or_init(|| Regex::new(r"^\s*-->\s+([^:\s][^:]*):(\d+)(?::\d+)?\s*$").unwrap());
|
||||
let loc_re =
|
||||
LOC_RE.get_or_init(|| Regex::new(r"^\s*-->\s+([^:\s][^:]*):(\d+)(?::\d+)?\s*$").unwrap());
|
||||
|
||||
let lines: Vec<&str> = output.lines().collect();
|
||||
let mut diagnostics = Vec::new();
|
||||
@@ -155,7 +155,8 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn ignores_non_diagnostic_lines() {
|
||||
let input = " Checking huskies v0.10.4\n Compiling foo v0.1.0\n Finished dev profile\n";
|
||||
let input =
|
||||
" Checking huskies v0.10.4\n Compiling foo v0.1.0\n Finished dev profile\n";
|
||||
assert!(parse_diagnostics(input).is_empty());
|
||||
}
|
||||
|
||||
@@ -192,8 +193,10 @@ error: could not compile `huskies` (bin \"huskies\") due to 3 previous errors; 1
|
||||
assert_eq!(summary.warning_count, 2);
|
||||
|
||||
// The 3 main compile errors must be present with file + line.
|
||||
let e0061: Vec<&Diagnostic> =
|
||||
diags.iter().filter(|d| d.code.as_deref() == Some("E0061")).collect();
|
||||
let e0061: Vec<&Diagnostic> = diags
|
||||
.iter()
|
||||
.filter(|d| d.code.as_deref() == Some("E0061"))
|
||||
.collect();
|
||||
assert_eq!(e0061.len(), 3);
|
||||
let files: Vec<Option<&str>> = e0061.iter().map(|d| d.file.as_deref()).collect();
|
||||
assert!(files.contains(&Some("server/src/agents/pool/auto_assign/merge.rs")));
|
||||
|
||||
Reference in New Issue
Block a user