2 ms·
If you absolutely want to golf it into one line: #[inline] const fn is_valid_scalar(c: u32) -> bool { matches!(c, 0..=0xD7FF) || matches!(c, 0xDE00..=0
by majewsky 5y ago
If you absolutely want to golf it into one line:
#[inline]
const fn is_valid_scalar(c: u32) -> bool {
matches!(c, 0..=0xD7FF) || matches!(c, 0xDE00..=0x10FFFF)
}
But I prefer your version for its clarity. It should compile into the same thing regardless.