summaryrefslogtreecommitdiff
path: root/crates/typst-syntax/src/lexer.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2024-02-28 15:24:50 +0100
committerGitHub <noreply@github.com>2024-02-28 14:24:50 +0000
commit8d63b0479c8b74a756a9e9b34d97f821f280fd22 (patch)
tree30cc34e366948d9ea461a1ad35f80bb5c89e10ab /crates/typst-syntax/src/lexer.rs
parent9d8df00ffb587f1e6062ae471d3da3b1ac61ba9e (diff)
Make use of `is_some_and` where applicable (#3523)
Diffstat (limited to 'crates/typst-syntax/src/lexer.rs')
-rw-r--r--crates/typst-syntax/src/lexer.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/typst-syntax/src/lexer.rs b/crates/typst-syntax/src/lexer.rs
index cd1998a6..300a8353 100644
--- a/crates/typst-syntax/src/lexer.rs
+++ b/crates/typst-syntax/src/lexer.rs
@@ -341,7 +341,7 @@ impl Lexer<'_> {
fn in_word(&self) -> bool {
let wordy = |c: Option<char>| {
- c.map_or(false, |c| {
+ c.is_some_and(|c| {
c.is_alphanumeric()
&& !matches!(
c.script(),
@@ -538,7 +538,7 @@ impl Lexer<'_> {
// Make sure not to confuse a range for the decimal separator.
if c != '.'
&& !self.s.at("..")
- && !self.s.scout(1).map_or(false, is_id_start)
+ && !self.s.scout(1).is_some_and(is_id_start)
&& self.s.eat_if('.')
&& base == 10
{
@@ -740,7 +740,7 @@ pub fn is_ident(string: &str) -> bool {
let mut chars = string.chars();
chars
.next()
- .map_or(false, |c| is_id_start(c) && chars.all(is_id_continue))
+ .is_some_and(|c| is_id_start(c) && chars.all(is_id_continue))
}
/// Whether a character can start an identifier.