Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
laudiacay committed Jan 5, 2022
1 parent ad6db48 commit cc3991f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
7 changes: 5 additions & 2 deletions utils/bitfield/src/rleplus/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,13 @@ impl BitField {
}

let last_value = ranges.last().map_or(0, |range| range.end - 1);
Ok( (Self {
Ok((
Self {
ranges,
..Default::default()
}, last_value as u64))
},
last_value as u64,
))
}

/// Decodes RLE+ encoded bytes into a bit field.
Expand Down
10 changes: 7 additions & 3 deletions utils/bitfield/src/unvalidated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl<'a> Validate<'a> for &'a mut UnvalidatedBitField {
}
/// it's O(1) to get max set value in bitfield during validation, so we do that here.
fn validate_with_max(self) -> Result<(&'a BitField, u64)> {
self.validate_mut_with_max().map(|(bf,max)| (&*bf,max))
self.validate_mut_with_max().map(|(bf, max)| (&*bf, max))
}
}

Expand All @@ -30,7 +30,9 @@ impl<'a> Validate<'a> for &'a BitField {
}
/// unimplemented because it's slow- this function exists to exploit that unvalidated
/// bitfields can get their max value quickly during validation
fn validate_with_max(self) -> Result<(&'a BitField, u64)> { unimplemented!(); }
fn validate_with_max(self) -> Result<(&'a BitField, u64)> {
unimplemented!();
}
}

/// A bit field that may not yet have been validated for valid RLE+.
Expand Down Expand Up @@ -58,7 +60,9 @@ impl UnvalidatedBitField {
let (bf, max) = BitField::from_bytes_with_max(bytes)?;
*self = Self::Validated(bf);
max
} else { unreachable!() };
} else {
unreachable!()
};

match self {
Self::Validated(bf) => Ok((bf, max)),
Expand Down

0 comments on commit cc3991f

Please sign in to comment.