Skip to content

Commit 00deeb3

Browse files
committed
Fix is_write_vectored in LineWriterShim
Now that BufWriter always claims to support vectored writes, look through it at the wrapped writer to decide whether to use vectored writes for LineWriter.
1 parent 9fc4423 commit 00deeb3

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

library/std/src/io/buffered/linewritershim.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ impl<'a, W: Write> LineWriterShim<'a, W> {
2020
Self { buffer }
2121
}
2222

23+
/// Get a reference to the inner writer (that is, the writer
24+
/// wrapped by the BufWriter).
25+
fn inner(&self) -> &W {
26+
self.buffer.get_ref()
27+
}
28+
2329
/// Get a mutable reference to the inner writer (that is, the writer
2430
/// wrapped by the BufWriter). Be careful with this writer, as writes to
2531
/// it will bypass the buffer.
@@ -227,7 +233,7 @@ impl<'a, W: Write> Write for LineWriterShim<'a, W> {
227233
}
228234

229235
fn is_write_vectored(&self) -> bool {
230-
self.buffer.is_write_vectored()
236+
self.inner().is_write_vectored()
231237
}
232238

233239
/// Write some data into this BufReader with line buffering. This means

0 commit comments

Comments
 (0)