Some simple Option / Result / iterator pattern simplifications (#3205)
This commit is contained in:
committed by
GitHub
parent
616dad43fd
commit
dcdbdd4bcc
@@ -96,8 +96,7 @@ impl LeafSet {
|
||||
/// Only applicable for the output MMR.
|
||||
fn unpruned_pre_cutoff(&self, cutoff_pos: u64, prune_list: &PruneList) -> Bitmap {
|
||||
(1..=cutoff_pos)
|
||||
.filter(|&x| pmmr::is_leaf(x))
|
||||
.filter(|&x| !prune_list.is_pruned(x))
|
||||
.filter(|&x| pmmr::is_leaf(x) && !prune_list.is_pruned(x))
|
||||
.map(|x| x as u32)
|
||||
.collect()
|
||||
}
|
||||
|
||||
+1
-4
@@ -107,10 +107,7 @@ where
|
||||
/// Elements can be of variable size (handled internally in the append-only file impl).
|
||||
///
|
||||
pub fn read(&self, position: u64) -> Option<T> {
|
||||
match self.file.read_as_elmt(position - 1) {
|
||||
Ok(x) => Some(x),
|
||||
Err(_) => None,
|
||||
}
|
||||
self.file.read_as_elmt(position - 1).ok()
|
||||
}
|
||||
|
||||
/// Rewind the backend file to the specified position.
|
||||
|
||||
Reference in New Issue
Block a user