fmt: the guards' new files

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VdfEGXA7aJ6ftMsCc9PJze
This commit is contained in:
Edward Langley
2026-09-22 20:59:39 -07:00
parent 77c2471bcc
commit 0b3fb055a9
3 changed files with 42 additions and 14 deletions
@@ -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",
),
),
];
+4 -1
View File
@@ -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
);
}
}
+31 -7
View File
@@ -70,7 +70,9 @@ fn test_module_paths(file: &Path, code: &str) -> Vec<PathBuf> {
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<usize> {
}
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}");
}