Skip to content

Commit

Permalink
fix: use let-else pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
rymnc committed Oct 30, 2024
1 parent a884429 commit f16cb2f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crates/services/p2p/src/cached_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ impl CachedView {
}
}

if missing_start.is_none() {
let Some(missing_start) = missing_start else {
self.update_metrics(increment_p2p_req_res_cache_hits);
return Ok(Some(items));
}
};

let missing_range = missing_start.unwrap()..range.end;
let missing_range = missing_start..range.end;

self.update_metrics(increment_p2p_req_res_cache_misses);
if let Some(fetched_items) = fetch_fn(view, missing_range.clone())? {
Expand Down

0 comments on commit f16cb2f

Please sign in to comment.