From 3ef9b8fbd7e861d5c6aa56d23fb43bd05dbfed1a Mon Sep 17 00:00:00 2001 From: Profpatsch Date: Sat, 24 Apr 2021 00:59:48 +0200 Subject: fix(users/Profpatsch/netencode): use write_all in encoder MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `write` returns the written usize; now I wonder why rustc didn’t at least produce a warning because the result was unused. Do we need to add any flags to `rustSimple`? Change-Id: If8d51d95c993dec6c92e46dbc82cd8cdd398f441 Reviewed-on: https://cl.tvl.fyi/c/depot/+/3056 Tested-by: BuildkiteCI Reviewed-by: sterni --- users/Profpatsch/netencode/netencode.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'users/Profpatsch') diff --git a/users/Profpatsch/netencode/netencode.rs b/users/Profpatsch/netencode/netencode.rs index ab10af307c6f..fcf642ca0262 100644 --- a/users/Profpatsch/netencode/netencode.rs +++ b/users/Profpatsch/netencode/netencode.rs @@ -158,12 +158,12 @@ pub fn encode(w: &mut W, u: &U) -> std::io::Result<()> { U::I7(i) => write!(w, "i7:{},", i), U::Text(s) => { write!(w, "t{}:", s.len()); - w.write(s.as_bytes()); + w.write_all(s.as_bytes()); write!(w, ",") } U::Binary(s) => { write!(w, "b{}:", s.len()); - w.write(&s); + w.write_all(&s); write!(w, ",") }, U::Sum(Tag{tag, val}) => encode_tag(w, tag, val), @@ -173,7 +173,7 @@ pub fn encode(w: &mut W, u: &U) -> std::io::Result<()> { encode_tag(&mut c, k, v)?; } write!(w, "{{{}:", c.get_ref().len())?; - w.write(c.get_ref())?; + w.write_all(c.get_ref())?; write!(w, "}}") }, U::List(l) => { @@ -182,7 +182,7 @@ pub fn encode(w: &mut W, u: &U) -> std::io::Result<()> { encode(&mut c, u)?; } write!(w, "[{}:", c.get_ref().len())?; - w.write(c.get_ref())?; + w.write_all(c.get_ref())?; write!(w, "]") } } -- cgit 1.4.1