From f0783632d315db90c0ca34d79d56207d132f3764 Mon Sep 17 00:00:00 2001 From: The8472 Date: Wed, 12 Aug 2020 20:09:55 +0200 Subject: more concise error matching --- library/std/src/sys/unix/fs.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'library/std/src/sys') diff --git a/library/std/src/sys/unix/fs.rs b/library/std/src/sys/unix/fs.rs index bcdc36a516e..63af25e3092 100644 --- a/library/std/src/sys/unix/fs.rs +++ b/library/std/src/sys/unix/fs.rs @@ -1162,7 +1162,7 @@ pub fn copy(from: &Path, to: &Path) -> io::Result { }; if let Err(ref copy_err) = copy_result { match copy_err.raw_os_error() { - Some(libc::ENOSYS) | Some(libc::EPERM) | Some(libc::EOPNOTSUPP) => { + Some(libc::ENOSYS | libc::EPERM | libc::EOPNOTSUPP) => { HAS_COPY_FILE_RANGE.store(false, Ordering::Relaxed); } _ => {} @@ -1176,13 +1176,9 @@ pub fn copy(from: &Path, to: &Path) -> io::Result { Ok(ret) => written += ret as u64, Err(err) => { match err.raw_os_error() { - Some(os_err) - if os_err == libc::ENOSYS - || os_err == libc::EXDEV - || os_err == libc::EINVAL - || os_err == libc::EPERM - || os_err == libc::EOPNOTSUPP => - { + Some( + libc::ENOSYS | libc::EXDEV | libc::EINVAL | libc::EPERM | libc::EOPNOTSUPP, + ) => { // Try fallback io::copy if either: // - Kernel version is < 4.5 (ENOSYS) // - Files are mounted on different fs (EXDEV) -- cgit 1.4.1-3-g733a5