We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2982fe3 commit 8d3e559Copy full SHA for 8d3e559
src/libstd/io/mod.rs
@@ -106,9 +106,9 @@ fn read_to_end<R: Read + ?Sized>(r: &mut R, buf: &mut Vec<u8>) -> Result<usize>
106
loop {
107
if len == buf.len() {
108
if buf.capacity() == buf.len() {
109
- // reserve() rounds up our request to the nearest power of two,
110
- // so after the first time the capacity is exceeded, we double
111
- // our capacity at each call to reserve.
+ // reserve() rounds up our request such that every request
+ // (with maybe the exception of the first request) for the
+ // same amount of space doubles our capacity.
112
buf.reserve(min_cap_bump);
113
}
114
let new_area = buf.capacity() - buf.len();
0 commit comments