Less slices (#9176)

* Less slices

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
Squirrel
2021-06-23 13:33:48 +01:00
committed by GitHub
parent 7b50bbb9bf
commit 07449840bd
11 changed files with 41 additions and 46 deletions
+3 -3
View File
@@ -259,7 +259,7 @@ fn partial_encode(partial: Partial, node_kind: NodeKind) -> Vec<u8> {
if number_nibble_encoded > 0 {
output.push(nibble_ops::pad_right((partial.0).1));
}
output.extend_from_slice(&partial.1[..]);
output.extend_from_slice(partial.1);
output
}
@@ -272,8 +272,8 @@ const BITMAP_LENGTH: usize = 2;
pub(crate) struct Bitmap(u16);
impl Bitmap {
pub fn decode(data: &[u8]) -> Result<Self, Error> {
Ok(Bitmap(u16::decode(&mut &data[..])?))
pub fn decode(mut data: &[u8]) -> Result<Self, Error> {
Ok(Bitmap(u16::decode(&mut data)?))
}
pub fn value_at(&self, i: usize) -> bool {