Impl `str::pattern::Pattern` for `Range*<char>`?

the example in str::find

assert_eq!(s.find(|c: char| (c < 'o') && (c > 'a')), Some(4));

could be much simpler

assert_eq!(s.find('b'..'o'), Some(4));
13 Likes

If it's only about using ranges, you can do:

assert_eq!(s.find(|c| ('b'..'o').contains(&c)), Some(4));
1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.