diff options
| author | Scott McMurray <scottmcm@users.noreply.github.com> | 2023-04-20 19:54:46 -0700 |
|---|---|---|
| committer | Scott McMurray <scottmcm@users.noreply.github.com> | 2023-04-20 19:54:46 -0700 |
| commit | 8055bb87c5d17f4e108097f24171cb8baab71072 (patch) | |
| tree | e855de473ceb4bf61316f7cca469348d69f0f6b0 /library/std/src/io/impls.rs | |
| parent | d19b64fb54391b64ce99981577c67c93ac2a9ffa (diff) | |
| download | rust-8055bb87c5d17f4e108097f24171cb8baab71072.tar.gz rust-8055bb87c5d17f4e108097f24171cb8baab71072.zip | |
More `mem::take` in `library`
A bunch of places were using `replace(…, &mut [])`, but that can just be `take`.
Diffstat (limited to 'library/std/src/io/impls.rs')
| -rw-r--r-- | library/std/src/io/impls.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/library/std/src/io/impls.rs b/library/std/src/io/impls.rs index e5048dcc8ac..9a9aec58dbb 100644 --- a/library/std/src/io/impls.rs +++ b/library/std/src/io/impls.rs @@ -336,7 +336,7 @@ impl Write for &mut [u8] { #[inline] fn write(&mut self, data: &[u8]) -> io::Result<usize> { let amt = cmp::min(data.len(), self.len()); - let (a, b) = mem::replace(self, &mut []).split_at_mut(amt); + let (a, b) = mem::take(self).split_at_mut(amt); a.copy_from_slice(&data[..amt]); *self = b; Ok(amt) |
