diff options
author | Jordan Bracco <href@random.sh> | 2021-11-12 17:11:11 +0100 |
---|---|---|
committer | Jordan Bracco <href@random.sh> | 2021-11-12 17:11:11 +0100 |
commit | 5beea314f4ad49acf57d6eff50c681ca780a2e66 (patch) | |
tree | 5dde726de5aad2ce76c3b336c820f49b67a5696f | |
parent | tree_bitmap: apply https://github.com/hroi/treebitmap/pull/15 (diff) |
tree_bitmap: thx clippy
-rw-r--r-- | native/treebitmap_nif/src/tree_bitmap/mod.rs | 11 | ||||
-rw-r--r-- | native/treebitmap_nif/src/tree_bitmap/node.rs | 6 |
2 files changed, 7 insertions, 10 deletions
diff --git a/native/treebitmap_nif/src/tree_bitmap/mod.rs b/native/treebitmap_nif/src/tree_bitmap/mod.rs index ca85e65..a6724f7 100644 --- a/native/treebitmap_nif/src/tree_bitmap/mod.rs +++ b/native/treebitmap_nif/src/tree_bitmap/mod.rs @@ -147,12 +147,9 @@ impl<T: Sized> TreeBitmap<T> { } } - match best_match { - Some((result_hdl, result_index)) => { - Some((bits_matched, self.results.get(&result_hdl, result_index))) - } - None => None, - } + best_match.map(|(result_hdl, result_index)| { + (bits_matched, self.results.get(&result_hdl, result_index)) + }) } pub fn insert(&mut self, nibbles: &[u8], masklen: u32, value: T) -> Option<T> { @@ -401,7 +398,7 @@ pub struct IterMut<'a, T: 'a> { nibbles: Vec<u8>, } -#[cfg_attr(rustfmt, rustfmt_skip)] +#[rustfmt::skip] static PREFIX_OF_BIT: [u8; 32] = [// 0 1 2 3 4 5 6 7 0b0000, 0b0000, 0b1000, 0b0000, 0b0100, 0b1000, 0b1100, 0b0000, // 8 9 10 11 12 13 14 15 diff --git a/native/treebitmap_nif/src/tree_bitmap/node.rs b/native/treebitmap_nif/src/tree_bitmap/node.rs index 7f6f734..4fbdcd5 100644 --- a/native/treebitmap_nif/src/tree_bitmap/node.rs +++ b/native/treebitmap_nif/src/tree_bitmap/node.rs @@ -17,7 +17,7 @@ pub const END_BIT_MASK: u32 = !END_BIT; // all bits except the end node bit type Table = [[u32; 16]; 5]; const IS_END_NODE: u32 = 1 << 16; -#[cfg_attr(rustfmt, rustfmt_skip)] +#[rustfmt::skip] static INTERNAL_LOOKUP_TABLE: Table = [ // mask = 00000, 0/0 [1<<31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], @@ -37,7 +37,7 @@ static INTERNAL_LOOKUP_TABLE: Table = [ pub const MSB: u32 = 1 << 31; -#[cfg_attr(rustfmt, rustfmt_skip)] +#[rustfmt::skip] pub static MATCH_MASKS: [u32; 16] = [MSB | MSB >> 1 | MSB >> 3 | MSB >> 7 | MSB >> 16, // 0000 MSB | MSB >> 1 | MSB >> 3 | MSB >> 7 | MSB >> 17, // 0001 MSB | MSB >> 1 | MSB >> 3 | MSB >> 8 | MSB >> 18, // 0010 @@ -115,7 +115,7 @@ pub const BIT_MATCH: [u32; 32] = [ 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, ]; -#[cfg_attr(rustfmt, rustfmt_skip)] +#[rustfmt::skip] const BIT_MEANING: &[&str] = &[ "*", "0*", "1*", |