Skip to content

Commit f078363

Browse files
committed
more concise error matching
1 parent 1316c78 commit f078363

File tree

1 file changed

+4
-8
lines changed
  • library/std/src/sys/unix

1 file changed

+4
-8
lines changed

library/std/src/sys/unix/fs.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -1162,7 +1162,7 @@ pub fn copy(from: &Path, to: &Path) -> io::Result<u64> {
11621162
};
11631163
if let Err(ref copy_err) = copy_result {
11641164
match copy_err.raw_os_error() {
1165-
Some(libc::ENOSYS) | Some(libc::EPERM) | Some(libc::EOPNOTSUPP) => {
1165+
Some(libc::ENOSYS | libc::EPERM | libc::EOPNOTSUPP) => {
11661166
HAS_COPY_FILE_RANGE.store(false, Ordering::Relaxed);
11671167
}
11681168
_ => {}
@@ -1176,13 +1176,9 @@ pub fn copy(from: &Path, to: &Path) -> io::Result<u64> {
11761176
Ok(ret) => written += ret as u64,
11771177
Err(err) => {
11781178
match err.raw_os_error() {
1179-
Some(os_err)
1180-
if os_err == libc::ENOSYS
1181-
|| os_err == libc::EXDEV
1182-
|| os_err == libc::EINVAL
1183-
|| os_err == libc::EPERM
1184-
|| os_err == libc::EOPNOTSUPP =>
1185-
{
1179+
Some(
1180+
libc::ENOSYS | libc::EXDEV | libc::EINVAL | libc::EPERM | libc::EOPNOTSUPP,
1181+
) => {
11861182
// Try fallback io::copy if either:
11871183
// - Kernel version is < 4.5 (ENOSYS)
11881184
// - Files are mounted on different fs (EXDEV)

0 commit comments

Comments
 (0)