Replace usages of ..i + 1
ranges with ..=i
.
This commit is contained in:
parent
431e0ab62f
commit
c025d61409
19 changed files with 36 additions and 36 deletions
|
@ -3610,7 +3610,7 @@ mod test_map {
|
|||
for i in 1..1001 {
|
||||
assert!(m.insert(i, i).is_none());
|
||||
|
||||
for j in 1..i + 1 {
|
||||
for j in 1..=i {
|
||||
let r = m.get(&j);
|
||||
assert_eq!(r, Some(&j));
|
||||
}
|
||||
|
@ -3629,7 +3629,7 @@ mod test_map {
|
|||
for i in 1..1001 {
|
||||
assert!(m.remove(&i).is_some());
|
||||
|
||||
for j in 1..i + 1 {
|
||||
for j in 1..=i {
|
||||
assert!(!m.contains_key(&j));
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 => {
|
||||
|
|
|
@ -487,7 +487,7 @@ fn make_command_line(prog: &OsStr, args: &[OsString]) -> io::Result<Vec<u16>> {
|
|||
} else {
|
||||
if x == '"' as u16 {
|
||||
// Add n+1 backslashes to total 2n+1 before internal '"'.
|
||||
cmd.extend((0..(backslashes + 1)).map(|_| '\\' as u16));
|
||||
cmd.extend((0..=backslashes).map(|_| '\\' as u16));
|
||||
}
|
||||
backslashes = 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue