Skip to content

Commit

Permalink
Fix clippy warning
Browse files Browse the repository at this point in the history
  • Loading branch information
sile committed Dec 10, 2023
1 parent 0a2bf42 commit 6d0d7c0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/node.rs
Expand Up @@ -101,7 +101,7 @@ impl<V> Node<V> {
handle_alloc_error(layout)
}

ptr::write(ptr.offset(FLAGS_OFFSET), flags.bits() as u8);
ptr::write(ptr.offset(FLAGS_OFFSET), flags.bits());
ptr::write(ptr.offset(LABEL_LEN_OFFSET), label.len() as u8);
ptr::copy_nonoverlapping(label.as_ptr(), ptr.offset(LABEL_OFFSET), label.len());

Expand Down Expand Up @@ -631,7 +631,7 @@ impl<V> Node<V> {
fn set_flags(&mut self, other: Flags, value: bool) {
let mut flags = self.flags();
flags.set(other, value);
unsafe { ptr::write(self.ptr, flags.bits() as u8) };
unsafe { ptr::write(self.ptr, flags.bits()) };
}
fn label_len(&self) -> usize {
unsafe { *self.ptr.offset(LABEL_LEN_OFFSET) as usize }
Expand Down
11 changes: 4 additions & 7 deletions src/tree.rs
Expand Up @@ -54,10 +54,7 @@ impl<V> PatriciaTree<V> {
.get_longest_common_prefix_mut(key, 0)
.map(|(n, v)| (&key.as_bytes()[..n], v))
}
pub fn iter_prefix<'a, 'b, K: ?Sized + BorrowedBytes>(
&'a self,
prefix: &'b K,
) -> Option<(usize, Nodes<V>)> {
pub fn iter_prefix<K: ?Sized + BorrowedBytes>(&self, prefix: &K) -> Option<(usize, Nodes<V>)> {
if let Some((common_prefix_len, node)) = self.root.get_prefix_node(prefix) {
let nodes = Nodes {
nodes: node.iter_descendant(),
Expand All @@ -68,9 +65,9 @@ impl<V> PatriciaTree<V> {
None
}
}
pub fn iter_prefix_mut<'a, 'b, K: ?Sized + BorrowedBytes>(
&'a mut self,
prefix: &'b K,
pub fn iter_prefix_mut<K: ?Sized + BorrowedBytes>(
&mut self,
prefix: &K,
) -> Option<(usize, NodesMut<V>)> {
if let Some((common_prefix_len, node)) = self.root.get_prefix_node_mut(prefix) {
let nodes = NodesMut {
Expand Down

0 comments on commit 6d0d7c0

Please sign in to comment.