mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-10-10 03:30:59 +00:00
test(harness): collapse live_marker_count match into matches!
Clippy (match_same_arms) on the Step C rewrite: Ok(false) and Err(_) both mean "treat as alive", so expressing it as `if matches!(..., Ok(true))` reads cleaner and satisfies the lint. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
39744068c9
commit
224ce9e21e
1 changed files with 11 additions and 11 deletions
|
|
@ -514,17 +514,17 @@ fn live_marker_count(root: &Path) -> usize {
|
|||
else {
|
||||
return false;
|
||||
};
|
||||
match fabro_proc::try_flock_exclusive(&file) {
|
||||
Ok(true) => {
|
||||
// Lock acquired: previous owner is gone. Drop the
|
||||
// file handle (releasing our just-acquired lock)
|
||||
// and remove the marker.
|
||||
drop(file);
|
||||
let _ = std::fs::remove_file(path);
|
||||
false
|
||||
}
|
||||
Ok(false) => true,
|
||||
Err(_) => true, // conservative: count unexpected errors as alive
|
||||
// If the lock is acquired, the previous owner is gone; drop
|
||||
// the file handle (releasing our just-acquired lock) and
|
||||
// remove the marker. Anything else (`Ok(false)` meaning
|
||||
// still held, `Err(_)` for unexpected IO errors) is treated
|
||||
// conservatively as live.
|
||||
if matches!(fabro_proc::try_flock_exclusive(&file), Ok(true)) {
|
||||
drop(file);
|
||||
let _ = std::fs::remove_file(path);
|
||||
false
|
||||
} else {
|
||||
true
|
||||
}
|
||||
})
|
||||
.count()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue