1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 05:40:03 -04:00

use map_or and map_or_else

This commit is contained in:
Emil Ernerfeldt
2021-10-20 16:33:59 +02:00
parent a0cd41755e
commit 40445c450c
8 changed files with 26 additions and 41 deletions

View File

@@ -150,8 +150,7 @@ fn remove_leading_indentation(code: &str) -> String {
let start = first_line_indent.min(indent);
let end = code
.find('\n')
.map(|endline| endline + 1)
.unwrap_or_else(|| code.len());
.map_or_else(|| code.len(), |endline| endline + 1);
out += &code[start..end];
code = &code[end..];
}