mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-04-24 17:48:34 +02:00
refactor(rust): cleanup path handling
- Avoids unnecessary string allocation when tracing paths - Replaces `mut path & path.push()` with `path.join()` - Avoids unncessary cloning of paths where applicable - Use `dunce` crate to remove `UNC` prefix - Improve performance of resolving `~` by avoiding unnecessary string allocations - Resolve `~`, `$Env:USERPROFILE` and `$HOME` consistenly between different code paths - Use `PathBuf` instead of `String` for paths in CLI args I may have missed a couple of places but I think I covered 90% of path handling in the codebase
This commit is contained in:
@@ -2,6 +2,7 @@ use std::collections::HashMap;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
use color_eyre::eyre::anyhow;
|
||||
use color_eyre::eyre::bail;
|
||||
use color_eyre::Result;
|
||||
use getset::CopyGetters;
|
||||
use getset::Getters;
|
||||
@@ -120,9 +121,7 @@ impl Monitor {
|
||||
.ok_or_else(|| anyhow!("there is no workspace"))?;
|
||||
|
||||
if workspace.maximized_window().is_some() {
|
||||
return Err(anyhow!(
|
||||
"cannot move native maximized window to another monitor or workspace"
|
||||
));
|
||||
bail!("cannot move native maximized window to another monitor or workspace");
|
||||
}
|
||||
|
||||
let container = workspace
|
||||
|
||||
Reference in New Issue
Block a user