1
//! Miscellaneous utilities
2

            
3
use crate::internal_prelude::*;
4

            
5
/// What `RangeInclusive::map` ought to be
6
///
7
/// Open-coding this at the call site would risk accidental change of the range type,
8
/// changing inclusiveness, etc.  This function has the same range type as argument and return.
9
36
pub(crate) fn map_range<T, U>(
10
36
    r: &RangeInclusive<T>,
11
36
    mut f: impl FnMut(&T) -> U,
12
36
) -> RangeInclusive<U> {
13
36
    f(r.start())..=f(r.end())
14
36
}