Coverage Report

Created: 2025-10-12 08:06

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.11.0/src/math.rs
Line
Count
Source
1
use std::ops::{Bound, Range, RangeBounds};
2
3
/// Normalize arbitrary `RangeBounds` to a `Range`
4
0
pub(super) fn simplify_range(range: impl RangeBounds<usize>, len: usize) -> Range<usize> {
5
0
    let start = match range.start_bound() {
6
0
        Bound::Unbounded => 0,
7
0
        Bound::Included(&i) if i <= len => i,
8
0
        Bound::Excluded(&i) if i < len => i + 1,
9
0
        bound => panic!("range start {bound:?} should be <= length {len}"),
10
    };
11
0
    let end = match range.end_bound() {
12
0
        Bound::Unbounded => len,
13
0
        Bound::Excluded(&i) if i <= len => i,
14
0
        Bound::Included(&i) if i < len => i + 1,
15
0
        bound => panic!("range end {bound:?} should be <= length {len}"),
16
    };
17
0
    if start > end {
18
0
        panic!(
19
0
            "range start {:?} should be <= range end {:?}",
20
0
            range.start_bound(),
21
0
            range.end_bound()
22
        );
23
0
    }
24
0
    start..end
25
0
}
Unexecuted instantiation: rayon::math::simplify_range::<core::ops::range::RangeFull>
Unexecuted instantiation: rayon::math::simplify_range::<_>