Make SanitizedPath wrap Path instead of Arc<Path> to avoid allocation (#37106)

Release Notes:

- N/A
This commit is contained in:
Michael Sloan
2025-08-28 13:32:30 -06:00
committed by GitHub
parent 69933d5b81
commit 47aaaa8bcf
14 changed files with 156 additions and 85 deletions
+2 -3
View File
@@ -2061,13 +2061,12 @@ impl Project {
exclude_sub_dirs: bool,
cx: &App,
) -> Option<bool> {
let sanitized_path = SanitizedPath::from(path);
let path = sanitized_path.as_path();
let path = SanitizedPath::new(path).as_path();
self.worktrees(cx)
.filter_map(|worktree| {
let worktree = worktree.read(cx);
let abs_path = worktree.as_local()?.abs_path();
let contains = path == abs_path
let contains = path == abs_path.as_ref()
|| (path.starts_with(abs_path) && (!exclude_sub_dirs || !metadata.is_dir));
contains.then(|| worktree.is_visible())
})