From 0b3fb055a95a694500fc5ba8ca2b057061fd6d53 Mon Sep 17 00:00:00 2001 From: Edward Langley Date: Tue, 22 Sep 2026 20:59:39 -0700 Subject: [PATCH] fmt: the guards' new files Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01VdfEGXA7aJ6ftMsCc9PJze --- .../src/ui/reduce/vocabulary_is_complete.rs | 13 ++++--- crates/improvise-protocol/src/reduce.rs | 5 ++- crates/improvise-protocol/src/source_scan.rs | 38 +++++++++++++++---- 3 files changed, 42 insertions(+), 14 deletions(-) diff --git a/crates/improvise-command/src/ui/reduce/vocabulary_is_complete.rs b/crates/improvise-command/src/ui/reduce/vocabulary_is_complete.rs index 6555f7dd..fb973742 100644 --- a/crates/improvise-command/src/ui/reduce/vocabulary_is_complete.rs +++ b/crates/improvise-command/src/ui/reduce/vocabulary_is_complete.rs @@ -26,10 +26,7 @@ const NOT_ON_THE_WIRE: &[(&str, Verdict)] = &[ ("HelpPageNext", Verdict::Command("HelpPage")), ("HelpPagePrev", Verdict::Command("HelpPage")), ("HelpPageSet", Verdict::Command("HelpPage")), - ( - "Save", - Verdict::Frame("Save"), - ), + ("Save", Verdict::Frame("Save")), ( "SaveAs", Verdict::Gap("improvise-2mqz: writes the host's Storage and has no frame"), @@ -68,7 +65,9 @@ const NOT_ON_THE_WIRE: &[(&str, Verdict)] = &[ ), ( "RebuildLayout", - Verdict::Off("refreshes the host's layout cache mid-batch; a client holds none (gotcha 23)"), + Verdict::Off( + "refreshes the host's layout cache mid-batch; a client holds none (gotcha 23)", + ), ), ( "AbortChain", @@ -80,7 +79,9 @@ const NOT_ON_THE_WIRE: &[(&str, Verdict)] = &[ ), ( "EnterEditAtCursor", - Verdict::Off("reads the host's layout; a client composes SetBuffer + ChangeMode off its own cache"), + Verdict::Off( + "reads the host's layout; a client composes SetBuffer + ChangeMode off its own cache", + ), ), ]; diff --git a/crates/improvise-protocol/src/reduce.rs b/crates/improvise-protocol/src/reduce.rs index 4bdec29c..9e816f01 100644 --- a/crates/improvise-protocol/src/reduce.rs +++ b/crates/improvise-protocol/src/reduce.rs @@ -668,6 +668,9 @@ mod tests { /// The guard is the signature above; this only keeps it compiled and reached. #[test] fn every_model_command_field_is_position_free() { - assert_eq!(position_free(&ModelCommand::TransposeAxes { view: "V".into() }), 1); + assert_eq!( + position_free(&ModelCommand::TransposeAxes { view: "V".into() }), + 1 + ); } } diff --git a/crates/improvise-protocol/src/source_scan.rs b/crates/improvise-protocol/src/source_scan.rs index 8d8cab19..0b35c845 100644 --- a/crates/improvise-protocol/src/source_scan.rs +++ b/crates/improvise-protocol/src/source_scan.rs @@ -70,7 +70,9 @@ fn test_module_paths(file: &Path, code: &str) -> Vec { if !is_test_cfg(line) { continue; } - let item = lines[i + 1..].iter().find(|l| !l.starts_with("#[") && !l.is_empty()); + let item = lines[i + 1..] + .iter() + .find(|l| !l.starts_with("#[") && !l.is_empty()); if let Some(name) = item.and_then(|l| out_of_line_mod(l)) { found.push(dir.join(name)); } @@ -223,7 +225,14 @@ fn raw_end(c: &[char], i: usize) -> Option { } k += 1; while k < c.len() { - if c[k] == '"' && c[k + 1..].iter().take(hashes).filter(|&&h| h == '#').count() == hashes { + if c[k] == '"' + && c[k + 1..] + .iter() + .take(hashes) + .filter(|&&h| h == '#') + .count() + == hashes + { return Some(k + 1 + hashes); } k += 1; @@ -289,16 +298,28 @@ mod tests { let lib = Path::new("/c/src/lib.rs"); assert_eq!( test_module_paths(lib, &code), - vec![PathBuf::from("/c/src/out_of_line"), PathBuf::from("/c/src/gated")] + vec![ + PathBuf::from("/c/src/out_of_line"), + PathBuf::from("/c/src/gated") + ] ); let nested = Path::new("/c/src/ui/reduce.rs"); assert_eq!( test_module_paths(nested, &code)[0], PathBuf::from("/c/src/ui/reduce/out_of_line") ); - assert!(is_module_file(Path::new("/c/src/gated"), Path::new("/c/src/gated.rs"))); - assert!(is_module_file(Path::new("/c/src/gated"), Path::new("/c/src/gated/a.rs"))); - assert!(!is_module_file(Path::new("/c/src/gated"), Path::new("/c/src/gatedx.rs"))); + assert!(is_module_file( + Path::new("/c/src/gated"), + Path::new("/c/src/gated.rs") + )); + assert!(is_module_file( + Path::new("/c/src/gated"), + Path::new("/c/src/gated/a.rs") + )); + assert!(!is_module_file( + Path::new("/c/src/gated"), + Path::new("/c/src/gatedx.rs") + )); } #[test] @@ -313,7 +334,10 @@ mod tests { let kept = code_only(text); assert!(kept.contains("Command::Kept(1)")); assert!(kept.contains("Command::AfterChar(3)")); - assert!(kept.contains("&'static str"), "a lifetime is not a char literal"); + assert!( + kept.contains("&'static str"), + "a lifetime is not a char literal" + ); for gone in ["LineComment", "Block", "StillBlock", "InString", "InRaw"] { assert!(!kept.contains(gone), "{gone} survived: {kept}"); }