vigna / dsi-bitstream-rs

A Rust implementation of read/write bit streams supporting several types of instantaneous codes
Apache License 2.0
7 stars 3 forks source link

make code base clippy-clean #3

Closed zacchiro closed 1 year ago

zacchiro commented 1 year ago

currently we do not pass "cargo clippy" due to the following errors (there are also warnings, but they are not blocking):

error: read amount is not handled
  --> src/backends/file_backend.rs:68:9
   |
68 |         self.file.read(res.as_mut())?;
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: use `Read::read_exact` instead, or handle partial reads
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unused_io_amount
   = note: `#[deny(clippy::unused_io_amount)]` on by default

error: written amount is not handled
  --> src/backends/file_backend.rs:79:9
   |
79 |         self.file.write(word.to_ne_bytes().as_ref())?;
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: use `Write::write_all` instead, or handle partial writes
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unused_io_amount
zacchiro commented 1 year ago

Edit: I've edited the snippt the clippy output above to the only two errors that matter for now, the rest are warnings that are not blocking for now.

Both outstanding errors are related to unhandled byte counts returned by read/write, which should be easy to fix.