diff options
| author | Benoît du Garreau <benoit@dugarreau.fr> | 2025-07-09 18:11:26 +0200 |
|---|---|---|
| committer | Benoît du Garreau <benoit@dugarreau.fr> | 2025-07-09 18:11:26 +0200 |
| commit | 803b4d262241b22a4dfe75fcec49eaf920e0816b (patch) | |
| tree | f7a993502d363fc242fd357735cdcf7b949c7622 /library/std/src/io/mod.rs | |
| parent | 6b3ae3f6e45a33c2d95fa0362c9b2593e567fd34 (diff) | |
| download | rust-803b4d262241b22a4dfe75fcec49eaf920e0816b.tar.gz rust-803b4d262241b22a4dfe75fcec49eaf920e0816b.zip | |
core: Remove `BorrowedCursor::init_ref` method
This method was not really useful: at no point one would only need to read the initialized part of the cursor without mutating it.
Diffstat (limited to 'library/std/src/io/mod.rs')
| -rw-r--r-- | library/std/src/io/mod.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/library/std/src/io/mod.rs b/library/std/src/io/mod.rs index 17c32d7a571..d351ee5e739 100644 --- a/library/std/src/io/mod.rs +++ b/library/std/src/io/mod.rs @@ -489,7 +489,7 @@ pub(crate) fn default_read_to_end<R: Read + ?Sized>( } }; - let unfilled_but_initialized = cursor.init_ref().len(); + let unfilled_but_initialized = cursor.init_mut().len(); let bytes_read = cursor.written(); let was_fully_initialized = read_buf.init_len() == buf_len; @@ -3053,7 +3053,7 @@ impl<T: Read> Read for Take<T> { // The condition above guarantees that `self.limit` fits in `usize`. let limit = self.limit as usize; - let extra_init = cmp::min(limit, buf.init_ref().len()); + let extra_init = cmp::min(limit, buf.init_mut().len()); // SAFETY: no uninit data is written to ibuf let ibuf = unsafe { &mut buf.as_mut()[..limit] }; @@ -3068,7 +3068,7 @@ impl<T: Read> Read for Take<T> { let mut cursor = sliced_buf.unfilled(); let result = self.inner.read_buf(cursor.reborrow()); - let new_init = cursor.init_ref().len(); + let new_init = cursor.init_mut().len(); let filled = sliced_buf.len(); // cursor / sliced_buf / ibuf must drop here |
