@@ -364,10 +364,10 @@ impl<R: Seek> Seek for BufReader<R> {
364364/// times. It also provides no advantage when writing to a destination that is
365365/// in memory, like a `Vec<u8>`.
366366///
367- /// When the `BufWriter` is dropped, the contents of its buffer will be written
368- /// out. However, any errors that happen in the process of flushing the buffer
369- /// when the writer is dropped will be ignored. Code that wishes to handle such
370- /// errors must manually call [`flush`] before the writer is dropped .
367+ /// It is critical to call [`flush`] before `BufWriter` is dropped. Though
368+ /// dropping will attempt to flush the the contents of the buffer, any errors
369+ /// that happen in the process will be ignored. Calling ['flush'] ensures that
370+ /// the buffer is empty and all errors have been observed .
371371///
372372/// # Examples
373373///
@@ -398,11 +398,12 @@ impl<R: Seek> Seek for BufReader<R> {
398398/// for i in 0..10 {
399399/// stream.write(&[i+1]).unwrap();
400400/// }
401+ /// stream.flush().unwrap();
401402/// ```
402403///
403404/// By wrapping the stream with a `BufWriter`, these ten writes are all grouped
404- /// together by the buffer, and will all be written out in one system call when
405- /// the `stream` is dropped .
405+ /// together by the buffer and will all be written out in one system call when
406+ /// the `stream` is flushed .
406407///
407408/// [`Write`]: ../../std/io/trait.Write.html
408409/// [`TcpStream::write`]: ../../std/net/struct.TcpStream.html#method.write
0 commit comments