chore: Clean up allocs around project panel (#15422)

A drive-by I did when looking at something else.

Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2024-07-29 14:21:41 +02:00 committed by GitHub
parent 6af72ab53a
commit c97d035eea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 18 additions and 18 deletions

View file

@ -3127,7 +3127,7 @@ pub struct Entry {
pub inode: u64,
pub mtime: Option<SystemTime>,
pub canonical_path: Option<PathBuf>,
pub canonical_path: Option<Box<Path>>,
pub is_symlink: bool,
/// Whether this entry is ignored by Git.
///
@ -3186,7 +3186,7 @@ impl Entry {
metadata: &fs::Metadata,
next_entry_id: &AtomicUsize,
root_char_bag: CharBag,
canonical_path: Option<PathBuf>,
canonical_path: Option<Box<Path>>,
) -> Self {
Self {
id: ProjectEntryId::new(next_entry_id),
@ -3942,7 +3942,7 @@ impl BackgroundScanner {
child_entry.is_external = true;
}
child_entry.canonical_path = Some(canonical_path);
child_entry.canonical_path = Some(canonical_path.into());
}
if child_entry.is_dir() {
@ -4073,21 +4073,21 @@ impl BackgroundScanner {
}
}
for (path, metadata) in relative_paths.iter().zip(metadata.iter()) {
for (path, metadata) in relative_paths.iter().zip(metadata.into_iter()) {
let abs_path: Arc<Path> = root_abs_path.join(&path).into();
match metadata {
Ok(Some((metadata, canonical_path))) => {
let ignore_stack = state
.snapshot
.ignore_stack_for_abs_path(&abs_path, metadata.is_dir);
let is_external = !canonical_path.starts_with(&root_canonical_path);
let mut fs_entry = Entry::new(
path.clone(),
metadata,
&metadata,
self.next_entry_id.as_ref(),
state.snapshot.root_char_bag,
if metadata.is_symlink {
Some(canonical_path.to_path_buf())
Some(canonical_path.into())
} else {
None
},
@ -4096,7 +4096,7 @@ impl BackgroundScanner {
let is_dir = fs_entry.is_dir();
fs_entry.is_ignored = ignore_stack.is_abs_path_ignored(&abs_path, is_dir);
fs_entry.is_external = !canonical_path.starts_with(&root_canonical_path);
fs_entry.is_external = is_external;
fs_entry.is_private = self.is_path_private(path);
if !is_dir && !fs_entry.is_ignored && !fs_entry.is_external {