about summary refs log tree commit diff
path: root/users/Profpatsch
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2021-04-23T22·59+0200
committerProfpatsch <mail@profpatsch.de>2021-04-30T21·47+0000
commit3ef9b8fbd7e861d5c6aa56d23fb43bd05dbfed1a (patch)
tree5c89db0aa0f7105b0414dc47e412f81df0955786 /users/Profpatsch
parent17239c597df554b9fe182e6a5a5b0d160217511e (diff)
fix(users/Profpatsch/netencode): use write_all in encoder r/2554
`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 <sternenseemann@systemli.org>
Diffstat (limited to 'users/Profpatsch')
-rw-r--r--users/Profpatsch/netencode/netencode.rs8
1 files changed, 4 insertions, 4 deletions
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: Write>(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: Write>(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: Write>(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, "]")
       }
   }