Skip to content

Commit

Permalink
csi/index/reference_sequence: Allow clippy::unnecessary_lazy_evaluati…
Browse files Browse the repository at this point in the history
…ons lint

Otherwise, this panics when `id` is 0. This is a known false positive in
clippy (rust-lang/rust-clippy#9422).
  • Loading branch information
zaeleus committed Jan 23, 2023
1 parent 3117092 commit 816d2b6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions noodles-csi/src/index/reference_sequence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ const M: usize = match NonZeroUsize::new(8) {

// parent of i = floor((i - 1) / M)
fn parent_id(id: usize) -> Option<usize> {
// See <https://github.com/rust-lang/rust-clippy/issues/9422>.
#[allow(clippy::unnecessary_lazy_evaluations)]
(id > 0).then(|| (id - 1) / M)
}

Expand Down

0 comments on commit 816d2b6

Please sign in to comment.