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
64
pub(crate) fn map_range<T, U>(
10
64
    r: &RangeInclusive<T>,
11
64
    mut f: impl FnMut(&T) -> U,
12
64
) -> RangeInclusive<U> {
13
64
    f(r.start())..=f(r.end())
14
64
}