From 1c64168759df382c7229b05188fb264e7a0c9430 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Sat, 31 Oct 2026 10:12:30 -0700 Subject: [PATCH] fix(mac): StaticConfigExt takes &Path instead of &PathBuf (clippy::ptr_arg) Fixes the 3 new lints at static_config.rs:719, :726 and :729 (the trait declarations of preload, postload and reload; the impls follow). They were introduced by kvtvnouo, 'refactor(mac): use StaticConfig and its family of komorebi-config', which turned the inherent methods into the extension trait; the original tip 9a58e511 did not have them. read gets a &Path through the previous revision, and the one clone of the path (the ReloadStaticConfiguration message) is path.to_path_buf(). No behaviour change. Verified: macOS fake-CC type-check (tools/fast-check) PASS, and fake-CC cargo clippy -p komorebi --all-targets -D warnings no longer reports the three. Verified on the Mini: not yet (cargo clippy --all-targets -D warnings). --- komorebi-for-mac/komorebi/src/static_config.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/komorebi-for-mac/komorebi/src/static_config.rs b/komorebi-for-mac/komorebi/src/static_config.rs index 3cd71ee4..ccc5b865 100644 --- a/komorebi-for-mac/komorebi/src/static_config.rs +++ b/komorebi-for-mac/komorebi/src/static_config.rs @@ -64,6 +64,7 @@ use std::io::ErrorKind; use std::io::Write; use std::os::unix::net::UnixListener; use std::os::unix::net::UnixStream; +use std::path::Path; use std::path::PathBuf; use std::sync::Arc; use std::sync::atomic::Ordering; @@ -716,23 +717,23 @@ impl ApplyGlobals for StaticConfig { pub trait StaticConfigExt: Sized { /// Makes the window manager from the file at `path`, and starts watching the file fn preload( - path: &PathBuf, + path: &Path, incoming: Receiver, unix_listener: Option, run_loop: &CFRetained, ) -> eyre::Result; /// Gives the monitors of the window manager what the file says about them - fn postload(path: &PathBuf, wm: &Arc>) -> eyre::Result<()>; + fn postload(path: &Path, wm: &Arc>) -> eyre::Result<()>; /// Replaces the configuration of the window manager with the file at `path` - fn reload(path: &PathBuf, wm: &mut WindowManager) -> eyre::Result<()>; + fn reload(path: &Path, wm: &mut WindowManager) -> eyre::Result<()>; } impl StaticConfigExt for StaticConfig { #[allow(clippy::too_many_lines)] fn preload( - path: &PathBuf, + path: &Path, incoming: Receiver, unix_listener: Option, run_loop: &CFRetained, @@ -811,7 +812,7 @@ impl StaticConfigExt for StaticConfig { known_window_ids: HashMap::new(), }; - let bytes = SocketMessage::ReloadStaticConfiguration(path.clone()).as_bytes()?; + let bytes = SocketMessage::ReloadStaticConfiguration(path.to_path_buf()).as_bytes()?; wm.hotwatch.watch(path, move |event| match event.kind { // Editing in Notepad sends a NoticeWrite while editing in (Neo)Vim sends @@ -830,7 +831,7 @@ impl StaticConfigExt for StaticConfig { Ok(wm) } - fn postload(path: &PathBuf, wm: &Arc>) -> eyre::Result<()> { + fn postload(path: &Path, wm: &Arc>) -> eyre::Result<()> { let mut value = Self::read(path)?; let mut wm = wm.lock(); @@ -992,7 +993,7 @@ impl StaticConfigExt for StaticConfig { Ok(()) } - fn reload(path: &PathBuf, wm: &mut WindowManager) -> eyre::Result<()> { + fn reload(path: &Path, wm: &mut WindowManager) -> eyre::Result<()> { let mut value = Self::read(path)?; value.apply_globals()?;