Skip to content

Commit 8258ca4

Browse files
committed
Only execute exclude_from_backups once
This was currently getting executed on all builds, even if the directory already exists. There shouldn't be any reason though to exclude the directory from backups on all builds, and after seeing this get a stack sample in a profile I figured it's best to ensure it only executes once in case the backing system implementation isn't the speediest.
1 parent 5c177f3 commit 8258ca4

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/cargo/core/compiler/layout.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,9 @@ impl Layout {
160160
pub fn prepare(&mut self) -> io::Result<()> {
161161
if fs::metadata(&self.root).is_err() {
162162
fs::create_dir_all(&self.root)?;
163+
self.exclude_from_backups(&self.root);
163164
}
164165

165-
self.exclude_from_backups(&self.root);
166-
167166
mkdir(&self.deps)?;
168167
mkdir(&self.native)?;
169168
mkdir(&self.incremental)?;

0 commit comments

Comments
 (0)