mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-19 07:08:48 +01:00
fix(kde): StaticConfigExt takes &Path instead of &PathBuf (clippy::ptr_arg)
The KDE twin of the macOS fix: the trait declarations of preload, postload and reload (static_config.rs:726, :732, :735; the impls follow) took &PathBuf, introduced by the same step 3 conversion to the extension trait. read takes &Path since the config-crate revision; the one clone of the path is path.to_path_buf(). No behaviour change. Verified: native cargo clippy --locked -p komorebi --all-targets -D warnings in komorebi-for-kde: clean (the 3 ptr_arg errors that predated the backend work are gone); cargo test --locked -p komorebi --lib: 294 passed, 0 failed.
This commit is contained in:
1 parent
5055e8a639
commit
a35573d8eb
1 file changed
+8
-7
@@ -86,6 +86,7 @@ use std::io::ErrorKind;
|
|||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::os::unix::net::UnixListener;
|
use std::os::unix::net::UnixListener;
|
||||||
use std::os::unix::net::UnixStream;
|
use std::os::unix::net::UnixStream;
|
||||||
|
use std::path::Path;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::sync::atomic::Ordering;
|
use std::sync::atomic::Ordering;
|
||||||
@@ -723,16 +724,16 @@ impl ApplyGlobals for StaticConfig {
|
|||||||
pub trait StaticConfigExt: Sized {
|
pub trait StaticConfigExt: Sized {
|
||||||
/// Makes the window manager from the file at `path`, and starts watching the file
|
/// Makes the window manager from the file at `path`, and starts watching the file
|
||||||
fn preload(
|
fn preload(
|
||||||
path: &PathBuf,
|
path: &Path,
|
||||||
incoming: Receiver<WindowManagerEvent>,
|
incoming: Receiver<WindowManagerEvent>,
|
||||||
unix_listener: Option<UnixListener>,
|
unix_listener: Option<UnixListener>,
|
||||||
) -> eyre::Result<WindowManager>;
|
) -> eyre::Result<WindowManager>;
|
||||||
|
|
||||||
/// Gives the monitors of the window manager what the file says about them
|
/// Gives the monitors of the window manager what the file says about them
|
||||||
fn postload(path: &PathBuf, wm: &Arc<Mutex<WindowManager>>) -> eyre::Result<()>;
|
fn postload(path: &Path, wm: &Arc<Mutex<WindowManager>>) -> eyre::Result<()>;
|
||||||
|
|
||||||
/// Replaces the configuration of the window manager with the file at `path`
|
/// 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 {
|
impl StaticConfigExt for StaticConfig {
|
||||||
@@ -755,7 +756,7 @@ impl StaticConfigExt for StaticConfig {
|
|||||||
/// - The file cannot be watched.
|
/// - The file cannot be watched.
|
||||||
#[allow(clippy::too_many_lines)]
|
#[allow(clippy::too_many_lines)]
|
||||||
fn preload(
|
fn preload(
|
||||||
path: &PathBuf,
|
path: &Path,
|
||||||
incoming: Receiver<WindowManagerEvent>,
|
incoming: Receiver<WindowManagerEvent>,
|
||||||
unix_listener: Option<UnixListener>,
|
unix_listener: Option<UnixListener>,
|
||||||
) -> eyre::Result<WindowManager> {
|
) -> eyre::Result<WindowManager> {
|
||||||
@@ -830,7 +831,7 @@ impl StaticConfigExt for StaticConfig {
|
|||||||
known_window_ids: HashMap::new(),
|
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 {
|
wm.hotwatch.watch(path, move |event| match event.kind {
|
||||||
// an editor either writes the file in place or replaces it with a new one, which is a
|
// an editor either writes the file in place or replaces it with a new one, which is a
|
||||||
@@ -860,7 +861,7 @@ impl StaticConfigExt for StaticConfig {
|
|||||||
/// # Errors
|
/// # Errors
|
||||||
///
|
///
|
||||||
/// The file cannot be read or is not a configuration ([`StaticConfig::read`]).
|
/// The file cannot be read or is not a configuration ([`StaticConfig::read`]).
|
||||||
fn postload(path: &PathBuf, wm: &Arc<Mutex<WindowManager>>) -> eyre::Result<()> {
|
fn postload(path: &Path, wm: &Arc<Mutex<WindowManager>>) -> eyre::Result<()> {
|
||||||
let mut value = Self::read(path)?;
|
let mut value = Self::read(path)?;
|
||||||
let mut wm = wm.lock();
|
let mut wm = wm.lock();
|
||||||
|
|
||||||
@@ -1036,7 +1037,7 @@ impl StaticConfigExt for StaticConfig {
|
|||||||
/// - The file cannot be read or is not a configuration ([`StaticConfig::read`]); nothing has
|
/// - The file cannot be read or is not a configuration ([`StaticConfig::read`]); nothing has
|
||||||
/// changed then.
|
/// changed then.
|
||||||
/// - A rule has a regular expression that is not valid; the settings before it have changed.
|
/// - A rule has a regular expression that is not valid; the settings before it have changed.
|
||||||
fn reload(path: &PathBuf, wm: &mut WindowManager) -> eyre::Result<()> {
|
fn reload(path: &Path, wm: &mut WindowManager) -> eyre::Result<()> {
|
||||||
let mut value = Self::read(path)?;
|
let mut value = Self::read(path)?;
|
||||||
|
|
||||||
value.apply_globals()?;
|
value.apply_globals()?;
|
||||||
|
|||||||
Reference in new issue
Block a user