Skip to content

Commit 3c0d641

Browse files
committed
cleaned up hardlink_dir_all
1 parent a754e15 commit 3c0d641

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

crates/cargo-util/src/paths.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -881,11 +881,9 @@ pub fn hardlink_dir_all(src: impl AsRef<Path>, dst: impl AsRef<Path>) -> io::Res
881881
hardlink_dir_all(entry.path(), dst.as_ref().join(entry.file_name()))?;
882882
} else {
883883
if let Err(err) = std::fs::hard_link(entry.path(), dst.as_ref().join(entry.file_name()))
884+
&& !matches!(err.kind(), io::ErrorKind::AlreadyExists)
884885
{
885-
match err.kind() {
886-
io::ErrorKind::AlreadyExists => continue,
887-
_ => return Err(err),
888-
}
886+
return Err(err);
889887
}
890888
}
891889
}

0 commit comments

Comments
 (0)