Skip to content

Commit

Permalink
log_unstable: Use ?
Browse files Browse the repository at this point in the history
  • Loading branch information
Hoverbear committed May 9, 2018
1 parent e334684 commit e946b20
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/log_unstable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,12 @@ impl Unstable {
// is any.
pub fn maybe_term(&self, idx: u64) -> Option<u64> {
if idx < self.offset {
match self.snapshot.as_ref() {
Some(snapshot) => {
let meta = snapshot.get_metadata();
if idx == meta.get_index() {
Some(meta.get_term())
} else {
None
}
},
None => None,
let snapshot = self.snapshot.as_ref()?;
let meta = snapshot.get_metadata();
if idx == meta.get_index() {
Some(meta.get_term())
} else {
None
}
} else {
self.maybe_last_index().and_then(|last| {
Expand Down

0 comments on commit e946b20

Please sign in to comment.