File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -715,6 +715,7 @@ impl<W: Write> Write for BufWriter<W> {
715
715
if self . buf . len ( ) + buf. len ( ) > self . buf . capacity ( ) {
716
716
self . flush_buf ( ) ?;
717
717
}
718
+ // FIXME: Why no len > capacity? Why not buffer len == capacity?
718
719
if buf. len ( ) >= self . buf . capacity ( ) {
719
720
self . panicked = true ;
720
721
let r = self . get_mut ( ) . write ( buf) ;
@@ -733,6 +734,7 @@ impl<W: Write> Write for BufWriter<W> {
733
734
if self . buf . len ( ) + buf. len ( ) > self . buf . capacity ( ) {
734
735
self . flush_buf ( ) ?;
735
736
}
737
+ // FIXME: Why no len > capacity? Why not buffer len == capacity?
736
738
if buf. len ( ) >= self . buf . capacity ( ) {
737
739
self . panicked = true ;
738
740
let r = self . get_mut ( ) . write_all ( buf) ;
@@ -749,6 +751,7 @@ impl<W: Write> Write for BufWriter<W> {
749
751
if self . buf . len ( ) + total_len > self . buf . capacity ( ) {
750
752
self . flush_buf ( ) ?;
751
753
}
754
+ // FIXME: Why no len > capacity? Why not buffer len == capacity?
752
755
if total_len >= self . buf . capacity ( ) {
753
756
self . panicked = true ;
754
757
let r = self . get_mut ( ) . write_vectored ( bufs) ;
@@ -1901,13 +1904,12 @@ mod tests {
1901
1904
IoSlice :: new( b"a" ) ,
1902
1905
] )
1903
1906
. unwrap( ) ,
1904
- 1 ,
1907
+ 2 ,
1905
1908
) ;
1906
1909
assert_eq ! ( a. get_ref( ) , b"\n " ) ;
1907
1910
1908
1911
assert_eq ! (
1909
1912
a. write_vectored( & [
1910
- IoSlice :: new( b"a" ) ,
1911
1913
IoSlice :: new( & [ ] ) ,
1912
1914
IoSlice :: new( b"b" ) ,
1913
1915
IoSlice :: new( & [ ] ) ,
@@ -1916,7 +1918,7 @@ mod tests {
1916
1918
IoSlice :: new( b"c" ) ,
1917
1919
] )
1918
1920
. unwrap( ) ,
1919
- 4 ,
1921
+ 3 ,
1920
1922
) ;
1921
1923
assert_eq ! ( a. get_ref( ) , b"\n " ) ;
1922
1924
a. flush ( ) . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments