From 96719ee66c2753039a6b952c15b6e43c3abb12ca Mon Sep 17 00:00:00 2001 From: Christopher Berner Date: Sun, 17 Mar 2024 14:23:31 -0700 Subject: [PATCH] Swap argument order for retain_in() --- fuzz/fuzz_targets/fuzz_redb.rs | 2 +- src/table.rs | 2 +- tests/basic_tests.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fuzz/fuzz_targets/fuzz_redb.rs b/fuzz/fuzz_targets/fuzz_redb.rs index b3f4293b..7e2ec3cc 100644 --- a/fuzz/fuzz_targets/fuzz_redb.rs +++ b/fuzz/fuzz_targets/fuzz_redb.rs @@ -450,7 +450,7 @@ fn handle_table_op(op: &FuzzOperation, reference: &mut BTreeMap, 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 } => { diff --git a/src/table.rs b/src/table.rs index 0396130a..3e9da467 100644 --- a/src/table.rs +++ b/src/table.rs @@ -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 + 'a, + predicate: F, ) -> Result where KR: Borrow> + 'a, diff --git a/tests/basic_tests.rs b/tests/basic_tests.rs index ad974660..59412ef9 100644 --- a/tests/basic_tests.rs +++ b/tests/basic_tests.rs @@ -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()); }