diff options
| author | bors <bors@rust-lang.org> | 2023-10-12 00:45:22 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-10-12 00:45:22 +0000 |
| commit | f562931178ff103f23b9e9a10dc0deb38e0d064f (patch) | |
| tree | a661535c6f8e7822a911c60cda9ee92575d9a9c7 /library/std/src | |
| parent | 9d1e4b7870f0aecb9f53e71f3cca3529b21d677a (diff) | |
| parent | dca90f7ec1a15fb47fbaba5bcde5073c699a8388 (diff) | |
| download | rust-f562931178ff103f23b9e9a10dc0deb38e0d064f.tar.gz rust-f562931178ff103f23b9e9a10dc0deb38e0d064f.zip | |
Auto merge of #116506 - Wilfred:remove_tmp_var, r=workingjubilee
Remove unnecessary tmp variable in default_read_exact This `tmp` variable has existed since the original implementation (added in ff81920f03866674080ac63b565cc9d30f80c450), but it's not necessary (maybe non-lexical lifetimes helped?). It's common to read std source code to understand how things actually work, and this tripped me up on my first read.
Diffstat (limited to 'library/std/src')
| -rw-r--r-- | library/std/src/io/mod.rs | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/library/std/src/io/mod.rs b/library/std/src/io/mod.rs index c93bf020252..e6431abcf82 100644 --- a/library/std/src/io/mod.rs +++ b/library/std/src/io/mod.rs @@ -513,8 +513,7 @@ pub(crate) fn default_read_exact<R: Read + ?Sized>(this: &mut R, mut buf: &mut [ match this.read(buf) { Ok(0) => break, Ok(n) => { - let tmp = buf; - buf = &mut tmp[n..]; + buf = &mut buf[n..]; } Err(ref e) if e.is_interrupted() => {} Err(e) => return Err(e), |
