Skip to content

Commit e509242

Browse files
authored
Rollup merge of #98330 - conradludgate:io-slice-mut-docs, r=Dylan-DPC
update ioslice docs to use shared slices I noticed that IoSlice docs were taking unnecessary mut slices, when they only accept shared slices
2 parents 1b48f09 + 44dbd98 commit e509242

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

library/std/src/io/mod.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1240,8 +1240,8 @@ impl<'a> IoSlice<'a> {
12401240
/// use std::io::IoSlice;
12411241
/// use std::ops::Deref;
12421242
///
1243-
/// let mut data = [1; 8];
1244-
/// let mut buf = IoSlice::new(&mut data);
1243+
/// let data = [1; 8];
1244+
/// let mut buf = IoSlice::new(&data);
12451245
///
12461246
/// // Mark 3 bytes as read.
12471247
/// buf.advance(3);
@@ -1435,10 +1435,10 @@ pub trait Write {
14351435
/// use std::fs::File;
14361436
///
14371437
/// fn main() -> std::io::Result<()> {
1438-
/// let mut data1 = [1; 8];
1439-
/// let mut data2 = [15; 8];
1440-
/// let io_slice1 = IoSlice::new(&mut data1);
1441-
/// let io_slice2 = IoSlice::new(&mut data2);
1438+
/// let data1 = [1; 8];
1439+
/// let data2 = [15; 8];
1440+
/// let io_slice1 = IoSlice::new(&data1);
1441+
/// let io_slice2 = IoSlice::new(&data2);
14421442
///
14431443
/// let mut buffer = File::create("foo.txt")?;
14441444
///

library/std/src/os/unix/net/ancillary.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -583,8 +583,8 @@ impl<'a> SocketAncillary<'a> {
583583
/// let mut ancillary = SocketAncillary::new(&mut ancillary_buffer[..]);
584584
/// ancillary.add_fds(&[sock.as_raw_fd()][..]);
585585
///
586-
/// let mut buf = [1; 8];
587-
/// let mut bufs = &mut [IoSlice::new(&mut buf[..])][..];
586+
/// let buf = [1; 8];
587+
/// let mut bufs = &mut [IoSlice::new(&buf[..])][..];
588588
/// sock.send_vectored_with_ancillary(bufs, &mut ancillary)?;
589589
/// Ok(())
590590
/// }

0 commit comments

Comments
 (0)