1
0
Fork 0
mirror of https://codeberg.org/icewind/bitbuffer.git synced 2026-06-03 16:44:06 +02:00

less panicy read_bool

This commit is contained in:
Robin Appelman 2019-12-25 14:27:29 +01:00
commit 5b89a5940d
2 changed files with 3 additions and 3 deletions

View file

@ -8,5 +8,5 @@ matrix:
- rust: nightly - rust: nightly
fast_finish: true fast_finish: true
script: script:
- cargo build --verbose --all - cargo test --all
- cargo test --verbose --all - cargo test --all --all-features

View file

@ -174,7 +174,7 @@ where
.get(byte_index) .get(byte_index)
.ok_or_else(|| ReadError::NotEnoughData { .ok_or_else(|| ReadError::NotEnoughData {
requested: 1, requested: 1,
bits_left: self.bit_len() - position, bits_left: self.bit_len().saturating_sub(position),
}) })
.map(|byte| { .map(|byte| {
let shifted = byte >> bit_offset; let shifted = byte >> bit_offset;