Take into account small Review requests

This commit is contained in:
ManyTheFish 2023-06-20 18:25:10 +02:00
parent 59f64a5256
commit 63ca25290b

View File

@ -57,13 +57,10 @@ impl<'ctx> DatabaseCache<'ctx> {
KC: BytesEncode<'v>, KC: BytesEncode<'v>,
DC: BytesDecodeOwned, DC: BytesDecodeOwned,
{ {
match cache.entry(cache_key) { if let Entry::Vacant(entry) = cache.entry(cache_key) {
Entry::Occupied(_) => {}
Entry::Vacant(entry) => {
let bitmap_ptr = db.get(txn, db_key)?.map(Cow::Borrowed); let bitmap_ptr = db.get(txn, db_key)?.map(Cow::Borrowed);
entry.insert(bitmap_ptr); entry.insert(bitmap_ptr);
} }
}
match cache.get(&cache_key).unwrap() { match cache.get(&cache_key).unwrap() {
Some(Cow::Borrowed(bytes)) => { Some(Cow::Borrowed(bytes)) => {
@ -90,9 +87,7 @@ impl<'ctx> DatabaseCache<'ctx> {
DC: BytesDecodeOwned, DC: BytesDecodeOwned,
KC::EItem: Sized, KC::EItem: Sized,
{ {
match cache.entry(cache_key) { if let Entry::Vacant(entry) = cache.entry(cache_key) {
Entry::Occupied(_) => {}
Entry::Vacant(entry) => {
let bitmap_ptr: Option<Cow<'ctx, [u8]>> = match db_keys { let bitmap_ptr: Option<Cow<'ctx, [u8]>> = match db_keys {
[] => None, [] => None,
[key] => db.get(txn, key)?.map(Cow::Borrowed), [key] => db.get(txn, key)?.map(Cow::Borrowed),
@ -113,7 +108,6 @@ impl<'ctx> DatabaseCache<'ctx> {
entry.insert(bitmap_ptr); entry.insert(bitmap_ptr);
} }
};
match cache.get(&cache_key).unwrap() { match cache.get(&cache_key).unwrap() {
Some(Cow::Borrowed(bytes)) => { Some(Cow::Borrowed(bytes)) => {