Skip to content

Commit 70ba320

Browse files
committed
More minor changes
- Fixed test after write_vectored bugfix - Some comments
1 parent e999ca5 commit 70ba320

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/libstd/io/buffered.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,7 @@ impl<W: Write> Write for BufWriter<W> {
715715
if self.buf.len() + buf.len() > self.buf.capacity() {
716716
self.flush_buf()?;
717717
}
718+
// FIXME: Why no len > capacity? Why not buffer len == capacity?
718719
if buf.len() >= self.buf.capacity() {
719720
self.panicked = true;
720721
let r = self.get_mut().write(buf);
@@ -733,6 +734,7 @@ impl<W: Write> Write for BufWriter<W> {
733734
if self.buf.len() + buf.len() > self.buf.capacity() {
734735
self.flush_buf()?;
735736
}
737+
// FIXME: Why no len > capacity? Why not buffer len == capacity?
736738
if buf.len() >= self.buf.capacity() {
737739
self.panicked = true;
738740
let r = self.get_mut().write_all(buf);
@@ -749,6 +751,7 @@ impl<W: Write> Write for BufWriter<W> {
749751
if self.buf.len() + total_len > self.buf.capacity() {
750752
self.flush_buf()?;
751753
}
754+
// FIXME: Why no len > capacity? Why not buffer len == capacity?
752755
if total_len >= self.buf.capacity() {
753756
self.panicked = true;
754757
let r = self.get_mut().write_vectored(bufs);
@@ -1901,13 +1904,12 @@ mod tests {
19011904
IoSlice::new(b"a"),
19021905
])
19031906
.unwrap(),
1904-
1,
1907+
2,
19051908
);
19061909
assert_eq!(a.get_ref(), b"\n");
19071910

19081911
assert_eq!(
19091912
a.write_vectored(&[
1910-
IoSlice::new(b"a"),
19111913
IoSlice::new(&[]),
19121914
IoSlice::new(b"b"),
19131915
IoSlice::new(&[]),
@@ -1916,7 +1918,7 @@ mod tests {
19161918
IoSlice::new(b"c"),
19171919
])
19181920
.unwrap(),
1919-
4,
1921+
3,
19201922
);
19211923
assert_eq!(a.get_ref(), b"\n");
19221924
a.flush().unwrap();

0 commit comments

Comments
 (0)