Skip to content

Commit

Permalink
Auto merge of #14728 - weihanglo:checksum, r=ehuss
Browse files Browse the repository at this point in the history
refactor(fingerprint): avoid unnecessary fopen calls
  • Loading branch information
bors committed Oct 24, 2024
2 parents 944559f + 692d830 commit e0fda67
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/cargo/core/compiler/fingerprint/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2017,16 +2017,16 @@ where
let Ok(current_file_len) = fs::metadata(&path).map(|m| m.len()) else {
return Some(StaleItem::FailedToReadMetadata(path.to_path_buf()));
};
let Ok(file) = File::open(path) else {
return Some(StaleItem::MissingFile(path.to_path_buf()));
};
if current_file_len != file_len {
return Some(StaleItem::FileSizeChanged {
path: path.to_path_buf(),
new_size: current_file_len,
old_size: file_len,
});
}
let Ok(file) = File::open(path) else {
return Some(StaleItem::MissingFile(path.to_path_buf()));
};
let Ok(checksum) = Checksum::compute(prior_checksum.algo, file) else {
return Some(StaleItem::UnableToReadFile(path.to_path_buf()));
};
Expand Down

0 comments on commit e0fda67

Please sign in to comment.