Skip to content

Commit

Permalink
Only execute exclude_from_backups once
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
alexcrichton committed May 3, 2019
1 parent 5c177f3 commit 8258ca4
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/cargo/core/compiler/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,9 @@ impl Layout {
pub fn prepare(&mut self) -> io::Result<()> {
if fs::metadata(&self.root).is_err() {
fs::create_dir_all(&self.root)?;
self.exclude_from_backups(&self.root);
}

self.exclude_from_backups(&self.root);

mkdir(&self.deps)?;
mkdir(&self.native)?;
mkdir(&self.incremental)?;
Expand Down

0 comments on commit 8258ca4

Please sign in to comment.