From 1cc3a1f7dfef251abc38c6f0f59c5bc7b0ead76b Mon Sep 17 00:00:00 2001 From: newtoallofthis123 Date: Mon, 26 Feb 2024 14:31:48 +0530 Subject: [PATCH] Run File Check --- swhks/src/environ.rs | 20 ++++++++++---------- swhks/src/main.rs | 3 ++- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/swhks/src/environ.rs b/swhks/src/environ.rs index 5361ea3..cef57ea 100644 --- a/swhks/src/environ.rs +++ b/swhks/src/environ.rs @@ -1,7 +1,7 @@ //! Environ.rs //! Defines modules and structs for handling environment variables and paths. -use std::{path::PathBuf, env::VarError}; +use std::{env::VarError, path::PathBuf}; use nix::unistd; @@ -39,9 +39,11 @@ impl Env { Ok(val) => val, Err(e) => match e { EnvError::DataHomeNotSet => { - log::warn!("XDG_DATA_HOME Variable is not set, falling back on hardcoded path."); + log::warn!( + "XDG_DATA_HOME Variable is not set, falling back on hardcoded path." + ); home.join(".local/share") - }, + } _ => panic!("Unexpected error: {:#?}", e), }, }; @@ -50,18 +52,16 @@ impl Env { Ok(val) => val, Err(e) => match e { EnvError::RuntimeDirNotSet => { - log::warn!("XDG_RUNTIME_DIR Variable is not set, falling back on hardcoded path."); + log::warn!( + "XDG_RUNTIME_DIR Variable is not set, falling back on hardcoded path." + ); PathBuf::from(format!("/run/user/{}", unistd::Uid::current())) - }, + } _ => panic!("Unexpected error: {:#?}", e), }, }; - Self { - data_home, - home, - runtime_dir, - } + Self { data_home, home, runtime_dir } } /// Actual interface to get the environment variable. diff --git a/swhks/src/main.rs b/swhks/src/main.rs index 8304986..b40a27b 100644 --- a/swhks/src/main.rs +++ b/swhks/src/main.rs @@ -11,7 +11,8 @@ use std::{ os::unix::net::UnixListener, path::Path, process::{exit, id, Command, Stdio}, - time::{SystemTime, UNIX_EPOCH}, sync::OnceLock, + sync::OnceLock, + time::{SystemTime, UNIX_EPOCH}, }; use sysinfo::{ProcessExt, System, SystemExt};