refactor(clippy): apply various lint fixes

This commit is contained in:
LGUG2Z
2022-11-13 15:31:19 -08:00
parent b010215318
commit 37edbcfebc
6 changed files with 45 additions and 51 deletions

View File

@@ -113,7 +113,7 @@ lazy_static! {
static ref HIDING_BEHAVIOUR: Arc<Mutex<HidingBehaviour>> =
Arc::new(Mutex::new(HidingBehaviour::Minimize));
static ref HOME_DIR: PathBuf = {
if let Ok(home_path) = std::env::var("KOMOREBI_CONFIG_HOME") {
std::env::var("KOMOREBI_CONFIG_HOME").map_or_else(|_| dirs::home_dir().expect("there is no home directory"), |home_path| {
let home = PathBuf::from(&home_path);
if home.as_path().is_dir() {
@@ -124,9 +124,7 @@ lazy_static! {
home_path
);
}
} else {
dirs::home_dir().expect("there is no home directory")
}
})
};
static ref DATA_DIR: PathBuf = dirs::data_local_dir().expect("there is no local data directory").join("komorebi");
static ref AHK_V1_EXE: String = {

View File

@@ -127,6 +127,7 @@ impl Monitor {
let workspaces = self.workspaces_mut();
#[allow(clippy::option_if_let_else)]
let target_workspace = match workspaces.get_mut(target_workspace_idx) {
None => {
workspaces.resize(target_workspace_idx + 1, Workspace::default());

View File

@@ -435,7 +435,7 @@ impl WindowManager {
socket.push("komorebic.sock");
let socket = socket.as_path();
let mut stream = UnixStream::connect(&socket)?;
let mut stream = UnixStream::connect(socket)?;
stream.write_all(state.as_bytes())?;
}
SocketMessage::Query(query) => {
@@ -458,7 +458,7 @@ impl WindowManager {
socket.push("komorebic.sock");
let socket = socket.as_path();
let mut stream = UnixStream::connect(&socket)?;
let mut stream = UnixStream::connect(socket)?;
stream.write_all(response.as_bytes())?;
}
SocketMessage::ResizeWindowEdge(direction, sizing) => {
@@ -856,7 +856,7 @@ impl WindowManager {
socket.push("komorebic.sock");
let socket = socket.as_path();
let mut stream = UnixStream::connect(&socket)?;
let mut stream = UnixStream::connect(socket)?;
stream.write_all(schema.as_bytes())?;
}
SocketMessage::SocketSchema => {
@@ -866,7 +866,7 @@ impl WindowManager {
socket.push("komorebic.sock");
let socket = socket.as_path();
let mut stream = UnixStream::connect(&socket)?;
let mut stream = UnixStream::connect(socket)?;
stream.write_all(schema.as_bytes())?;
}
};