Make SanitizedPath wrap Path instead of Arc<Path> to avoid allocation (#37106)
Release Notes: - N/A
This commit is contained in:
@@ -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())
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user