diff options
| author | Steven Fackler <sfackler@gmail.com> | 2019-02-11 19:31:37 -0800 |
|---|---|---|
| committer | Steven Fackler <sfackler@gmail.com> | 2019-02-13 19:40:17 -0800 |
| commit | 596f18201c7863d8b02fe6fa1872cf3ba2b6b381 (patch) | |
| tree | 1b152d89591c590eb92bf1b18591836e88ccf347 /src/libstd/io/util.rs | |
| parent | 31bcec648aa57391115f877a2ca022d7ff6415aa (diff) | |
| download | rust-596f18201c7863d8b02fe6fa1872cf3ba2b6b381.tar.gz rust-596f18201c7863d8b02fe6fa1872cf3ba2b6b381.zip | |
impl Deref/DerefMut for IoVec types
Returning &'a mut [u8] was unsound, and we may as well just have them directly deref to their slices to make it easier to work with them.
Diffstat (limited to 'src/libstd/io/util.rs')
| -rw-r--r-- | src/libstd/io/util.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libstd/io/util.rs b/src/libstd/io/util.rs index 6743018793f..5ce955eb1e4 100644 --- a/src/libstd/io/util.rs +++ b/src/libstd/io/util.rs @@ -156,7 +156,7 @@ impl Read for Repeat { fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result<usize> { let mut nwritten = 0; for buf in bufs { - nwritten += self.read(buf.as_mut_slice())?; + nwritten += self.read(buf)?; } Ok(nwritten) } @@ -207,7 +207,7 @@ impl Write for Sink { #[inline] fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> { - let total_len = bufs.iter().map(|b| b.as_slice().len()).sum(); + let total_len = bufs.iter().map(|b| b.len()).sum(); Ok(total_len) } |
