Skip to content

Commit

Permalink
fix: clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
arriqaaq committed Nov 27, 2024
1 parent 62d21a0 commit 6111c97
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/art.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3264,7 +3264,7 @@ mod tests {

for i in 0..1_000_000 {
let key = VariableSizeKey::from_str(&format!("key_{}", i)).unwrap();
tree.insert_unchecked(&key, i as i32, 0, 0).unwrap();
tree.insert_unchecked(&key, i, 0, 0).unwrap();
}

println!("Insertion time for 1M unique keys: {:?}", start.elapsed());
Expand All @@ -3277,14 +3277,14 @@ mod tests {
let start = std::time::Instant::now();

let num_keys = 100; // Number of keys
let versions_per_key = 100_00; // Number of versions per key
let versions_per_key = 10_000; // Number of versions per key

// Insert 100,00 versions for each of the 100 keys
for key_index in 0..num_keys {
let key = VariableSizeKey::from_str(&format!("key_{}", key_index)).unwrap();

for version_index in 0..versions_per_key {
let value = (key_index * versions_per_key + version_index) as i32; // Value for versioning
let value = key_index * versions_per_key + version_index; // Value for versioning
tree.insert_unchecked(&key, value, 0, 0).unwrap();
}
}
Expand Down
12 changes: 4 additions & 8 deletions src/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ impl<V: Clone> BTree<V> {
}
}

pub fn search(&self, version: u64, ts: u64) -> Option<&LeafValue<V>> {
#[allow(unused)]
fn search(&self, version: u64, ts: u64) -> Option<&LeafValue<V>> {
let root = self.root.as_ref()?;
self.search_node(root, version, ts)
}
Expand Down Expand Up @@ -152,11 +153,10 @@ impl<V: Clone> BTree<V> {

pub fn last_less_or_equal_ts(&self, ts: u64) -> Option<&LeafValue<V>> {
let root = self.root.as_ref()?;
self.last_less_or_equal_ts_node(root, ts, None)
Self::last_less_or_equal_ts_node(root, ts, None)
}

fn last_less_or_equal_ts_node<'a>(
&'a self,
node: &'a Node<V>,
ts: u64,
mut best_so_far: Option<&'a LeafValue<V>>,
Expand All @@ -173,7 +173,7 @@ impl<V: Clone> BTree<V> {

if !node.is_leaf {
for child in &node.children {
best_so_far = self.last_less_or_equal_ts_node(child, ts, best_so_far);
best_so_far = Self::last_less_or_equal_ts_node(child, ts, best_so_far);
}
}

Expand All @@ -186,10 +186,6 @@ impl<V: Clone> BTree<V> {
Some(root) => Box::new(NodeIterator::new(root)),
}
}

pub fn clear(&mut self) {
self.root = None;
}
}

// Iterator for Node
Expand Down

0 comments on commit 6111c97

Please sign in to comment.