Skip to content

Commit 7d0cc40

Browse files
committed
io::Take: avoid new BorrowedBuf creation in some case
1 parent 2a06022 commit 7d0cc40

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

library/std/src/io/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2989,7 +2989,7 @@ impl<T: Read> Read for Take<T> {
29892989
return Ok(());
29902990
}
29912991

2992-
if self.limit <= buf.capacity() as u64 {
2992+
if self.limit < buf.capacity() as u64 {
29932993
// if we just use an as cast to convert, limit may wrap around on a 32 bit target
29942994
let limit = cmp::min(self.limit, usize::MAX as u64) as usize;
29952995

0 commit comments

Comments
 (0)