diff options
| author | bors <bors@rust-lang.org> | 2023-09-03 21:15:12 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-09-03 21:15:12 +0000 |
| commit | 58e967a9cc3bd39122e8cb728e8cec6e3a4eeef2 (patch) | |
| tree | ae0315ea68ed3598936cafcd8c05895f6a1382c4 /library/std | |
| parent | 21305f4d5f32bcbc97f3b8e66dc23b03f3d948c4 (diff) | |
| parent | 487fe2e5ad440d0b304d12bf6968b701932df695 (diff) | |
| download | rust-58e967a9cc3bd39122e8cb728e8cec6e3a4eeef2.tar.gz rust-58e967a9cc3bd39122e8cb728e8cec6e3a4eeef2.zip | |
Auto merge of #115518 - matthiaskrgr:rollup-vksprou, r=matthiaskrgr
Rollup of 5 pull requests Successful merges: - #115279 (RangeFull: Remove parens around .. in documentation snippet) - #115318 (Reference uplifted clippy lints' rustc name in the release notes) - #115445 (remove some unused crate deps) - #115489 (Use std::io::Error::is_interrupted everywhere) - #115512 (Command::spawn: Fix STARTUPINFOW.cb being initialized with the address of size_of) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'library/std')
| -rw-r--r-- | library/std/src/io/buffered/bufwriter.rs | 2 | ||||
| -rw-r--r-- | library/std/src/io/copy.rs | 11 | ||||
| -rw-r--r-- | library/std/src/io/mod.rs | 2 | ||||
| -rw-r--r-- | library/std/src/os/unix/fs.rs | 4 | ||||
| -rw-r--r-- | library/std/src/os/wasi/fs.rs | 4 | ||||
| -rw-r--r-- | library/std/src/sys/hermit/mod.rs | 2 | ||||
| -rw-r--r-- | library/std/src/sys/hermit/net.rs | 2 | ||||
| -rw-r--r-- | library/std/src/sys/unix/fs.rs | 2 | ||||
| -rw-r--r-- | library/std/src/sys/unix/mod.rs | 2 | ||||
| -rw-r--r-- | library/std/src/sys/unix/net.rs | 2 | ||||
| -rw-r--r-- | library/std/src/sys/unix/process/process_unix.rs | 2 | ||||
| -rw-r--r-- | library/std/src/sys/windows/process.rs | 2 |
12 files changed, 19 insertions, 18 deletions
diff --git a/library/std/src/io/buffered/bufwriter.rs b/library/std/src/io/buffered/bufwriter.rs index 0f04f291117..95ba82e1e07 100644 --- a/library/std/src/io/buffered/bufwriter.rs +++ b/library/std/src/io/buffered/bufwriter.rs @@ -237,7 +237,7 @@ impl<W: ?Sized + Write> BufWriter<W> { )); } Ok(n) => guard.consume(n), - Err(ref e) if e.kind() == io::ErrorKind::Interrupted => {} + Err(ref e) if e.is_interrupted() => {} Err(e) => return Err(e), } } diff --git a/library/std/src/io/copy.rs b/library/std/src/io/copy.rs index 3322940d245..57d226a3771 100644 --- a/library/std/src/io/copy.rs +++ b/library/std/src/io/copy.rs @@ -1,4 +1,4 @@ -use super::{BorrowedBuf, BufReader, BufWriter, ErrorKind, Read, Result, Write, DEFAULT_BUF_SIZE}; +use super::{BorrowedBuf, BufReader, BufWriter, Read, Result, Write, DEFAULT_BUF_SIZE}; use crate::alloc::Allocator; use crate::cmp; use crate::collections::VecDeque; @@ -30,6 +30,7 @@ mod tests; /// /// [`read`]: Read::read /// [`write`]: Write::write +/// [`ErrorKind::Interrupted`]: crate::io::ErrorKind::Interrupted /// /// # Examples /// @@ -163,7 +164,7 @@ where // from adding I: Read match self.read(&mut []) { Ok(_) => {} - Err(e) if e.kind() == ErrorKind::Interrupted => continue, + Err(e) if e.is_interrupted() => continue, Err(e) => return Err(e), } let buf = self.buffer(); @@ -243,7 +244,7 @@ impl<I: Write + ?Sized> BufferedWriterSpec for BufWriter<I> { // Read again if the buffer still has enough capacity, as BufWriter itself would do // This will occur if the reader returns short reads } - Err(ref e) if e.kind() == ErrorKind::Interrupted => {} + Err(ref e) if e.is_interrupted() => {} Err(e) => return Err(e), } } else { @@ -275,7 +276,7 @@ impl<A: Allocator> BufferedWriterSpec for Vec<u8, A> { let mut buf: BorrowedBuf<'_> = self.spare_capacity_mut().into(); match reader.read_buf(buf.unfilled()) { Ok(()) => {} - Err(e) if e.kind() == ErrorKind::Interrupted => continue, + Err(e) if e.is_interrupted() => continue, Err(e) => return Err(e), }; @@ -307,7 +308,7 @@ fn stack_buffer_copy<R: Read + ?Sized, W: Write + ?Sized>( loop { match reader.read_buf(buf.unfilled()) { Ok(()) => {} - Err(e) if e.kind() == ErrorKind::Interrupted => continue, + Err(e) if e.is_interrupted() => continue, Err(e) => return Err(e), }; diff --git a/library/std/src/io/mod.rs b/library/std/src/io/mod.rs index e89843b5703..eca64fb6063 100644 --- a/library/std/src/io/mod.rs +++ b/library/std/src/io/mod.rs @@ -1647,7 +1647,7 @@ pub trait Write { )); } Ok(n) => IoSlice::advance_slices(&mut bufs, n), - Err(ref e) if e.kind() == ErrorKind::Interrupted => {} + Err(ref e) if e.is_interrupted() => {} Err(e) => return Err(e), } } diff --git a/library/std/src/os/unix/fs.rs b/library/std/src/os/unix/fs.rs index 029de8fbf76..b6dc1a062ed 100644 --- a/library/std/src/os/unix/fs.rs +++ b/library/std/src/os/unix/fs.rs @@ -123,7 +123,7 @@ pub trait FileExt { buf = &mut tmp[n..]; offset += n as u64; } - Err(ref e) if e.kind() == io::ErrorKind::Interrupted => {} + Err(ref e) if e.is_interrupted() => {} Err(e) => return Err(e), } } @@ -258,7 +258,7 @@ pub trait FileExt { buf = &buf[n..]; offset += n as u64 } - Err(ref e) if e.kind() == io::ErrorKind::Interrupted => {} + Err(ref e) if e.is_interrupted() => {} Err(e) => return Err(e), } } diff --git a/library/std/src/os/wasi/fs.rs b/library/std/src/os/wasi/fs.rs index 160c8f1eca2..3da8c835511 100644 --- a/library/std/src/os/wasi/fs.rs +++ b/library/std/src/os/wasi/fs.rs @@ -82,7 +82,7 @@ pub trait FileExt { buf = &mut tmp[n..]; offset += n as u64; } - Err(ref e) if e.kind() == io::ErrorKind::Interrupted => {} + Err(ref e) if e.is_interrupted() => {} Err(e) => return Err(e), } } @@ -162,7 +162,7 @@ pub trait FileExt { buf = &buf[n..]; offset += n as u64 } - Err(ref e) if e.kind() == io::ErrorKind::Interrupted => {} + Err(ref e) if e.is_interrupted() => {} Err(e) => return Err(e), } } diff --git a/library/std/src/sys/hermit/mod.rs b/library/std/src/sys/hermit/mod.rs index 744cb0c911b..abd7eb353f8 100644 --- a/library/std/src/sys/hermit/mod.rs +++ b/library/std/src/sys/hermit/mod.rs @@ -200,7 +200,7 @@ where { loop { match cvt(f()) { - Err(ref e) if e.kind() == ErrorKind::Interrupted => {} + Err(ref e) if e.is_interrupted() => {} other => return other, } } diff --git a/library/std/src/sys/hermit/net.rs b/library/std/src/sys/hermit/net.rs index bffda7a8139..a564f1698ba 100644 --- a/library/std/src/sys/hermit/net.rs +++ b/library/std/src/sys/hermit/net.rs @@ -102,7 +102,7 @@ impl Socket { match unsafe { netc::poll(&mut pollfd, 1, timeout) } { -1 => { let err = io::Error::last_os_error(); - if err.kind() != io::ErrorKind::Interrupted { + if !err.is_interrupted() { return Err(err); } } diff --git a/library/std/src/sys/unix/fs.rs b/library/std/src/sys/unix/fs.rs index a5604c92a80..61ea87a5b0c 100644 --- a/library/std/src/sys/unix/fs.rs +++ b/library/std/src/sys/unix/fs.rs @@ -792,7 +792,7 @@ impl Drop for Dir { fn drop(&mut self) { let r = unsafe { libc::closedir(self.0) }; assert!( - r == 0 || crate::io::Error::last_os_error().kind() == crate::io::ErrorKind::Interrupted, + r == 0 || crate::io::Error::last_os_error().is_interrupted(), "unexpected error during closedir: {:?}", crate::io::Error::last_os_error() ); diff --git a/library/std/src/sys/unix/mod.rs b/library/std/src/sys/unix/mod.rs index 6d743903314..692d3ab7cc9 100644 --- a/library/std/src/sys/unix/mod.rs +++ b/library/std/src/sys/unix/mod.rs @@ -320,7 +320,7 @@ where { loop { match cvt(f()) { - Err(ref e) if e.kind() == ErrorKind::Interrupted => {} + Err(ref e) if e.is_interrupted() => {} other => return other, } } diff --git a/library/std/src/sys/unix/net.rs b/library/std/src/sys/unix/net.rs index 7258c222a6c..ade8c75a657 100644 --- a/library/std/src/sys/unix/net.rs +++ b/library/std/src/sys/unix/net.rs @@ -184,7 +184,7 @@ impl Socket { match unsafe { libc::poll(&mut pollfd, 1, timeout) } { -1 => { let err = io::Error::last_os_error(); - if err.kind() != io::ErrorKind::Interrupted { + if !err.is_interrupted() { return Err(err); } } diff --git a/library/std/src/sys/unix/process/process_unix.rs b/library/std/src/sys/unix/process/process_unix.rs index 3963e7f52d5..75b54064501 100644 --- a/library/std/src/sys/unix/process/process_unix.rs +++ b/library/std/src/sys/unix/process/process_unix.rs @@ -165,7 +165,7 @@ impl Command { assert!(p.wait().is_ok(), "wait() should either return Ok or panic"); return Err(Error::from_raw_os_error(errno)); } - Err(ref e) if e.kind() == ErrorKind::Interrupted => {} + Err(ref e) if e.is_interrupted() => {} Err(e) => { assert!(p.wait().is_ok(), "wait() should either return Ok or panic"); panic!("the CLOEXEC pipe failed: {e:?}") diff --git a/library/std/src/sys/windows/process.rs b/library/std/src/sys/windows/process.rs index 6f46da1748a..84a75d21305 100644 --- a/library/std/src/sys/windows/process.rs +++ b/library/std/src/sys/windows/process.rs @@ -352,7 +352,7 @@ impl Command { }; si_ptr = &mut si_ex as *mut _ as _; } else { - si.cb = mem::size_of::<c::STARTUPINFOW> as c::DWORD; + si.cb = mem::size_of::<c::STARTUPINFOW>() as c::DWORD; si_ptr = &mut si as *mut _ as _; } |
