From 6db666fce1fb4627c06d147554b8e1eb9970619e Mon Sep 17 00:00:00 2001 From: Mo Date: Sat, 24 Feb 2024 16:59:11 +0100 Subject: 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> * Put the expand_tilde test at the end of the file * Remove unused importsw--- helix-loader/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'helix-loader/src/lib.rs') diff --git a/helix-loader/src/lib.rs b/helix-loader/src/lib.rs index f8fac670..93488e45 100644 --- a/helix-loader/src/lib.rs +++ b/helix-loader/src/lib.rs @@ -53,7 +53,7 @@ fn prioritize_runtime_dirs() -> Vec { rt_dirs.push(conf_rt_dir); if let Ok(dir) = std::env::var("HELIX_RUNTIME") { - let dir = path::expand_tilde(dir); + let dir = path::expand_tilde(Path::new(&dir)); rt_dirs.push(path::normalize(dir)); } -- cgit v1.2.3-70-g09d2