Skip to content

Commit 8b5a439

Browse files
committed
Option improvements
1 parent f4787ba commit 8b5a439

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/bucket.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@ pub(crate) trait BucketIApi<'tx, T: TxIApi<'tx>>:
902902

903903
/// See [BucketApi::bucket]
904904
fn api_bucket(self, name: &[u8]) -> Option<Self> {
905-
if let Some(w) = self.split_ow().deref() {
905+
if let Some(w) = self.split_ow().as_ref() {
906906
if let Some(child) = w.buckets.get(name) {
907907
return Some(*child);
908908
}
@@ -917,7 +917,7 @@ pub(crate) trait BucketIApi<'tx, T: TxIApi<'tx>>:
917917

918918
// Otherwise create a bucket and cache it.
919919
let child = self.open_bucket(v);
920-
if let Some(ref mut w) = self.split_ow_mut().deref_mut() {
920+
if let Some(w) = self.split_ow_mut().as_mut() {
921921
let tx = self.split_bound();
922922
let bump = tx.bump();
923923
let name = bump.alloc_slice_copy(name);
@@ -1089,15 +1089,15 @@ pub(crate) trait BucketIApi<'tx, T: TxIApi<'tx>>:
10891089
if id != ZERO_PGID {
10901090
panic!("inline bucket non-zero page access(2): {} != 0", id)
10911091
}
1092-
return if let Some(root_node) = w.as_ref().map(|wb| wb.root_node).flatten() {
1092+
return if let Some(root_node) = w.as_ref().and_then(|wb| wb.root_node) {
10931093
PageNode::Node(root_node)
10941094
} else {
10951095
PageNode::Page(r.inline_page.unwrap())
10961096
};
10971097
}
10981098

10991099
// Check the node cache for non-inline buckets.
1100-
if let Some(wb) = w.deref() {
1100+
if let Some(wb) = w.as_ref() {
11011101
if let Some(node) = wb.nodes.get(&id) {
11021102
return PageNode::Node(*node);
11031103
}

src/tx.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@ pub(crate) trait TxIApi<'tx>: SplitRef<TxR<'tx>, Self::BucketType, TxW<'tx>> {
766766
}
767767

768768
fn any_page<'a>(&'a self, id: PgId) -> AnyPage<'a, 'tx> {
769-
if let Some(ref tx) = self.split_ow().deref() {
769+
if let Some(tx) = self.split_ow().as_ref() {
770770
if let Some(page) = tx.pages.get(&id).map(|p| p.as_ref()) {
771771
page.fast_check(id);
772772
return AnyPage::Pending(*page);
@@ -850,7 +850,7 @@ pub(crate) trait TxIApi<'tx>: SplitRef<TxR<'tx>, Self::BucketType, TxW<'tx>> {
850850
}
851851

852852
fn rollback(self) -> crate::Result<()> {
853-
if let Some(mut w) = self.split_ow_mut().as_mut() {
853+
if let Some(w) = self.split_ow_mut().as_mut() {
854854
w.tx_closing_state = TxClosingState::ExplicitRollback;
855855
}
856856
Ok(())

0 commit comments

Comments
 (0)