diff options
| author | The8472 <git@infinite-source.de> | 2020-08-12 20:09:55 +0200 |
|---|---|---|
| committer | The8472 <git@infinite-source.de> | 2020-08-12 20:09:55 +0200 |
| commit | f0783632d315db90c0ca34d79d56207d132f3764 (patch) | |
| tree | a113142f265e84603171d7a4ab9ccdb5a134fda2 /library/std/src/sys | |
| parent | 1316c786a08344c965a97b1b67c76a300a479eec (diff) | |
| download | rust-f0783632d315db90c0ca34d79d56207d132f3764.tar.gz rust-f0783632d315db90c0ca34d79d56207d132f3764.zip | |
more concise error matching
Diffstat (limited to 'library/std/src/sys')
| -rw-r--r-- | library/std/src/sys/unix/fs.rs | 12 |
1 files changed, 4 insertions, 8 deletions
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<u64> { }; 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<u64> { 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) |
