summaryrefslogtreecommitdiff
path: root/helix-term/src/ui/mod.rs
diff options
context:
space:
mode:
authorMo2024-02-24 15:59:11 +0000
committerGitHub2024-02-24 15:59:11 +0000
commit6db666fce1fb4627c06d147554b8e1eb9970619e (patch)
tree8ed202acf6936485c33f033e6af5f294dfad0da0 /helix-term/src/ui/mod.rs
parentec9efdef3b2f613a86098058f5705e7863e375e2 (diff)
Optimization of tilde expansion (#9709)
* Use next and avoid a redundant prefix strip * Avoid allocations Especially when `expand_tilde` is claled on a path that doesn't contain a tilde. * Add a test * Use Into<Cow<…>> * Put the expand_tilde test at the end of the file * Remove unused importsw
Diffstat (limited to 'helix-term/src/ui/mod.rs')
-rw-r--r--helix-term/src/ui/mod.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/helix-term/src/ui/mod.rs b/helix-term/src/ui/mod.rs
index d27e8355..0873116c 100644
--- a/helix-term/src/ui/mod.rs
+++ b/helix-term/src/ui/mod.rs
@@ -428,9 +428,9 @@ pub mod completers {
path
} else {
match path.parent() {
- Some(path) if !path.as_os_str().is_empty() => path.to_path_buf(),
+ Some(path) if !path.as_os_str().is_empty() => Cow::Borrowed(path),
// Path::new("h")'s parent is Some("")...
- _ => helix_stdx::env::current_working_dir(),
+ _ => Cow::Owned(helix_stdx::env::current_working_dir()),
}
};