diff --git a/src/main.rs b/src/main.rs index b1beefd..6301af7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -164,7 +164,7 @@ async fn start( Ok(env) => { for systemd_env in env { // Only update the envvar if unset - if std::env::var_os(&systemd_env.key) == None { + if std::env::var_os(&systemd_env.key).is_none() { // Blacklist of envvars that we shouldn't touch (taken from KDE) if (!systemd_env.key.starts_with("XDG_") || systemd_env.key == "XDG_DATA_DIRS" @@ -243,11 +243,10 @@ async fn start( .instrument(stderr_span) }) .with_on_exit(move |_, _, _, will_restart| { - if !will_restart { - if let Some(tx) = settings_exit_tx.lock().unwrap().take() { + if !will_restart + && let Some(tx) = settings_exit_tx.lock().unwrap().take() { _ = tx.send(()); } - } async {} }), ) @@ -533,17 +532,15 @@ async fn start_component( }) .with_on_start(move |pman, pkey, _will_restart| async move { #[cfg(feature = "systemd")] - if *is_systemd_used() { - if let Ok((innr_cmd, Some(pid))) = pman.get_exe_and_pid(pkey).await { - if let Err(err) = spawn_scope(innr_cmd.clone(), vec![pid]).await { + if *is_systemd_used() + && let Ok((innr_cmd, Some(pid))) = pman.get_exe_and_pid(pkey).await + && let Err(err) = spawn_scope(innr_cmd.clone(), vec![pid]).await { warn!( "Failed to spawn scope for {}. Creating transient unit failed \ with {}", innr_cmd, err ); }; - } - } }) .with_on_exit(move |mut _pman, _key, err_code, _will_restart| { if let Some(err) = err_code { diff --git a/src/notifications.rs b/src/notifications.rs index 0ead417..9efad8e 100644 --- a/src/notifications.rs +++ b/src/notifications.rs @@ -26,6 +26,7 @@ pub fn create_socket() -> Result<(OwnedFd, OwnedFd)> { Ok((OwnedFd::from(sock_1), OwnedFd::from(sock_2))) } +#[allow(clippy::too_many_arguments)] pub fn notifications_process( span: tracing::Span, cmd: &'static str, diff --git a/src/systemd.rs b/src/systemd.rs index 6cbfa02..a155df0 100644 --- a/src/systemd.rs +++ b/src/systemd.rs @@ -17,11 +17,11 @@ pub struct EnvVar { pub value: String, } -impl Into for (&str, &str) { - fn into(self) -> EnvVar { +impl From<(&str, &str)> for EnvVar { + fn from(val: (&str, &str)) -> Self { EnvVar { - key: self.0.to_owned(), - value: self.1.to_owned(), + key: val.0.to_owned(), + value: val.1.to_owned(), } } }