Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/syntax/src/parsing/text_token_source.rs')
-rw-r--r--crates/syntax/src/parsing/text_token_source.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/crates/syntax/src/parsing/text_token_source.rs b/crates/syntax/src/parsing/text_token_source.rs
index 0614194a56..11dfc63a65 100644
--- a/crates/syntax/src/parsing/text_token_source.rs
+++ b/crates/syntax/src/parsing/text_token_source.rs
@@ -44,8 +44,7 @@ impl<'t> TokenSource for TextTokenSource<'t> {
fn is_keyword(&self, kw: &str) -> bool {
self.token_offset_pairs
.get(self.curr.1)
- .map(|(token, offset)| &self.text[TextRange::at(*offset, token.len)] == kw)
- .unwrap_or(false)
+ .map_or(false, |(token, offset)| &self.text[TextRange::at(*offset, token.len)] == kw)
}
}
@@ -55,8 +54,7 @@ fn mk_token(pos: usize, token_offset_pairs: &[(Token, TextSize)]) -> parser::Tok
token.kind,
token_offset_pairs
.get(pos + 1)
- .map(|(_, next_offset)| offset + token.len == *next_offset)
- .unwrap_or(false),
+ .map_or(false, |(_, next_offset)| offset + token.len == *next_offset),
),
None => (EOF, false),
};