Skip to content

Commit

Permalink
Swap argument order for retain_in()
Browse files Browse the repository at this point in the history
  • Loading branch information
cberner committed Mar 17, 2024
1 parent 9cf3b2d commit 96719ee
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion fuzz/fuzz_targets/fuzz_redb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ fn handle_table_op(op: &FuzzOperation, reference: &mut BTreeMap<u64, usize>, tab
let start = start_key.value;
let end = start + len.value;
let modulus = modulus.value;
table.retain_in(|x, _| x % modulus == 0, start..end)?;
table.retain_in(start..end, |x, _| x % modulus == 0)?;
reference.retain(|x, _| (*x < start || *x >= end) || *x % modulus == 0);
}
FuzzOperation::Retain { modulus } => {
Expand Down
2 changes: 1 addition & 1 deletion src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ impl<'txn, K: Key + 'static, V: Value + 'static> Table<'txn, K, V> {
///
pub fn retain_in<'a, KR, F: for<'f> FnMut(K::SelfType<'f>, V::SelfType<'f>) -> bool>(
&mut self,
predicate: F,
range: impl RangeBounds<KR> + 'a,
predicate: F,
) -> Result
where
KR: Borrow<K::SelfType<'a>> + 'a,
Expand Down
2 changes: 1 addition & 1 deletion tests/basic_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ fn retain() {
assert_eq!(table.len().unwrap(), 10);

// Test retain_in
table.retain_in(|_, _| false, ..5).unwrap();
table.retain_in(..5, |_, _| false).unwrap();
for i in 0..5 {
assert!(table.insert(&i, &i).unwrap().is_none());
}
Expand Down

0 comments on commit 96719ee

Please sign in to comment.