mirror of
https://github.com/emilk/egui.git
synced 2026-09-02 06:40:06 -04:00
use map_or and map_or_else
This commit is contained in:
@@ -319,8 +319,7 @@ impl<'a> Iterator for Parser<'a> {
|
||||
let end = self
|
||||
.s
|
||||
.find(&['*', '`', '~', '_', '/', '$', '^', '\\', '<', '[', '\n'][..])
|
||||
.map(|special| special.max(1)) // make sure we swallow at least one character
|
||||
.unwrap_or_else(|| self.s.len());
|
||||
.map_or_else(|| self.s.len(), |special| special.max(1));
|
||||
|
||||
let item = Item::Text(self.style, &self.s[..end]);
|
||||
self.s = &self.s[end..];
|
||||
|
||||
Reference in New Issue
Block a user