about summary refs log tree commit diff
path: root/src/libstd/io
diff options
context:
space:
mode:
authorCorey Farwell <coreyf@rwell.org>2018-12-04 11:17:58 -0800
committerCorey Farwell <coreyf@rwell.org>2018-12-04 12:05:19 -0800
commitc025d6140999e07ddf0294f0676c64ff2322a210 (patch)
tree51430da0c1c62d653d24db743ffd5e6f0d39bf8d /src/libstd/io
parent431e0ab62f7730f11db693c23f48403e4c719f82 (diff)
downloadrust-c025d6140999e07ddf0294f0676c64ff2322a210.tar.gz
rust-c025d6140999e07ddf0294f0676c64ff2322a210.zip
Replace usages of `..i + 1` ranges with `..=i`.
Diffstat (limited to 'src/libstd/io')
-rw-r--r--src/libstd/io/buffered.rs2
-rw-r--r--src/libstd/io/mod.rs2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs
index 476ee3f71ca..7ede050da6c 100644
--- a/src/libstd/io/buffered.rs
+++ b/src/libstd/io/buffered.rs
@@ -918,7 +918,7 @@ impl<W: Write> Write for LineWriter<W> {
         // some data then we *must* report that we wrote that data, so future
         // errors are ignored. We set our internal `need_flush` flag, though, in
         // case flushing fails and we need to try it first next time.
-        let n = self.inner.write(&buf[..i + 1])?;
+        let n = self.inner.write(&buf[..=i])?;
         self.need_flush = true;
         if self.flush().is_err() || n != i + 1 {
             return Ok(n)
diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs
index 076524e624a..dc97701d889 100644
--- a/src/libstd/io/mod.rs
+++ b/src/libstd/io/mod.rs
@@ -1261,7 +1261,7 @@ fn read_until<R: BufRead + ?Sized>(r: &mut R, delim: u8, buf: &mut Vec<u8>)
             };
             match memchr::memchr(delim, available) {
                 Some(i) => {
-                    buf.extend_from_slice(&available[..i + 1]);
+                    buf.extend_from_slice(&available[..=i]);
                     (true, i + 1)
                 }
                 None => {