Skip to content

Commit

Permalink
Fix more Clippy lints and add a test for #170
Browse files Browse the repository at this point in the history
  • Loading branch information
myrrlyn committed Jul 10, 2022
1 parent 09e3327 commit 210ce13
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/array/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ fn ops() {
let mut f = !e;
assert_eq!(f[.. 4], bitarr![1, 0, 0, 1][.. 4]);

let _: &BitSlice = &*a;
let _: &mut BitSlice = &mut *f;
let _: &BitSlice = &a;
let _: &mut BitSlice = &mut f;
}

#[test]
Expand Down
4 changes: 2 additions & 2 deletions src/boxed/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ fn ops() {
let mut f = !e;
assert_eq!(f, bitbox![1, 0, 0, 1]);

let _: &BitSlice = &*a;
let _: &mut BitSlice = &mut *f;
let _: &BitSlice = &a;
let _: &mut BitSlice = &mut f;
}

#[test]
Expand Down
13 changes: 13 additions & 0 deletions tests/issues.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,3 +361,16 @@ fn issue_142() {
bits![0, 1, 1, 1, 0, 1]
);
}

#[test]
#[cfg(feature = "std")]
fn issue_170() {
use std::io::Read;

let mut data: Vec<u8> = vec![0; 1];
let bytes = bits![0; 8]
.to_bitvec()
.read(&mut data)
.expect("read should not fail");
assert_eq!(bytes, 1, "should read exactly 1 byte");
}

0 comments on commit 210ce13

Please sign in to comment.