From ad285bcaa1b4fee56729ebb0bb8ba97dd8707b07 Mon Sep 17 00:00:00 2001 From: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com> Date: Sat, 8 Aug 2026 10:58:26 +0800 Subject: [PATCH] style: rustfmt --- crates/tty7-core/src/daemon/update_guard.rs | 17 ++++++++--------- crates/tty7-core/src/daemon/winproc.rs | 5 ++++- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/crates/tty7-core/src/daemon/update_guard.rs b/crates/tty7-core/src/daemon/update_guard.rs index 14f01b17..2ced4128 100644 --- a/crates/tty7-core/src/daemon/update_guard.rs +++ b/crates/tty7-core/src/daemon/update_guard.rs @@ -95,10 +95,13 @@ pub(crate) fn held() -> bool { let Ok(contents) = std::fs::read_to_string(&path) else { return false; }; - let written = std::fs::metadata(&path).and_then(|meta| meta.modified()).ok(); - let holds = contents.trim().parse::().ok().is_some_and(|pid| { - writer_holds(process_alive(pid), winproc::creation_time(pid), written) - }); + let written = std::fs::metadata(&path) + .and_then(|meta| meta.modified()) + .ok(); + let holds = + contents.trim().parse::().ok().is_some_and(|pid| { + writer_holds(process_alive(pid), winproc::creation_time(pid), written) + }); if !holds { log::info!("removing a stale update guard at {}", path.display()); let _ = std::fs::remove_file(&path); @@ -108,11 +111,7 @@ pub(crate) fn held() -> bool { /// The staleness policy, pure so every case is testable: `started` is when /// the process wearing the recorded pid began, `written` the guard's mtime. -fn writer_holds( - alive: bool, - started: Option, - written: Option, -) -> bool { +fn writer_holds(alive: bool, started: Option, written: Option) -> bool { if !alive { return false; } diff --git a/crates/tty7-core/src/daemon/winproc.rs b/crates/tty7-core/src/daemon/winproc.rs index 364a3281..0f4c05e6 100644 --- a/crates/tty7-core/src/daemon/winproc.rs +++ b/crates/tty7-core/src/daemon/winproc.rs @@ -143,7 +143,10 @@ pub(crate) fn creation_time(pid: u32) -> Option { let unix_ticks = ticks.checked_sub(11_644_473_600 * 10_000_000)?; Some( std::time::UNIX_EPOCH - + std::time::Duration::new(unix_ticks / 10_000_000, (unix_ticks % 10_000_000) as u32 * 100), + + std::time::Duration::new( + unix_ticks / 10_000_000, + (unix_ticks % 10_000_000) as u32 * 100, + ), ) } }