Use cfg!(windows)

This commit is contained in:
Chris Denton 2024-07-02 06:04:23 +00:00
parent 3d6cc60535
commit b998cff558
No known key found for this signature in database
GPG Key ID: 713472F2F45627DE

View File

@ -1678,7 +1678,7 @@ impl Build {
return;
}
if let Err(e) = fs::remove_file(dst) {
if e.kind() != io::ErrorKind::NotFound {
if cfg!(windows) && e.kind() != io::ErrorKind::NotFound {
// workaround for https://github.com/rust-lang/rust/issues/127126
// if removing the file fails, attempt to rename it instead.
let now = t!(SystemTime::now().duration_since(SystemTime::UNIX_EPOCH));