Skip to content

Commit 770542b

Browse files
authored
Merge pull request #14 from hashmismatch/warnings
removed some warnings
2 parents 88490b1 + 49809fd commit 770542b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packed_struct/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ fn main() {
2020
}
2121

2222
// bits
23-
for i in 1..((up_to_bytes * 8) + 1) {
23+
for i in 1..(up_to_bytes * 8) {
2424
let b = format!("bits_type!(Bits{}, {}, Bytes{}, {});\r\n", i, i, (i as f32 / 8.0).ceil() as usize, if (i % 8) == 0 {
2525
"BitsFullBytes"
2626
} else {

packed_struct/src/types_num.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ macro_rules! as_bytes {
133133

134134
macro_rules! from_bytes {
135135
(1, $v: expr, $T: ident) => {
136-
(($v[0] as $T) << 0)
136+
$v[0] as $T
137137
};
138138
(2, $v: expr, $T: ident) => {
139139
(($v[0] as $T) << 8) |
@@ -583,7 +583,7 @@ impl<T, B, I> PackedStructSlice for MsbInteger<T, B, I> where B: NumberOfBits, I
583583
let mut s = Default::default();
584584
// hack to infer the type
585585
{
586-
Self::unpack(&s);
586+
Self::unpack(&s)?;
587587
}
588588
s.as_mut_bytes_slice().copy_from_slice(src);
589589
Self::unpack(&s)
@@ -663,7 +663,7 @@ impl<T, B, I> PackedStructSlice for LsbInteger<T, B, I> where B: NumberOfBits +
663663
let mut s = Default::default();
664664
// hack to infer the type
665665
{
666-
Self::unpack(&s);
666+
Self::unpack(&s)?;
667667
}
668668
s.as_mut_bytes_slice().copy_from_slice(src);
669669
Self::unpack(&s)

0 commit comments

Comments
 (0)