use write_all instead of write (#488)

io::Write::write is not guaranteed to process the entire buffer. it return how many bytes were processed, which might be smaller than a given buffer’s length. use write_all instead.
This commit is contained in:
icodezjb
2018-08-03 18:25:21 +08:00
committed by Gav Wood
parent 05f49f1d5f
commit d50d6b302a
+1 -1
View File
@@ -80,7 +80,7 @@ impl Output for Vec<u8> {
#[cfg(feature = "std")]
impl<W: ::std::io::Write> Output for W {
fn write(&mut self, bytes: &[u8]) {
(self as &mut ::std::io::Write).write(bytes).expect("Codec outputs are infallible");
(self as &mut ::std::io::Write).write_all(bytes).expect("Codec outputs are infallible");
}
}