Skip to content

Commit

Permalink
Replace filter_map and bool::then with filter and map.
Browse files Browse the repository at this point in the history
  • Loading branch information
olson-sean-k committed Nov 16, 2023
1 parent 89c6313 commit 303b5d6
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/diagnostics/miette.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,19 @@ pub fn diagnose<'i, 't>(
}) as BoxedDiagnostic
}),
)
.chain(tokenized.tokens().last().into_iter().filter_map(|token| {
matches!(token.kind(), TokenKind::Separator(_)).then(|| {
Box::new(TerminatingSeparatorWarning {
expression: tokenized.expression().clone(),
span: (*token.annotation()).into(),
}) as BoxedDiagnostic
})
}))
.chain(
tokenized
.tokens()
.last()
.into_iter()
.filter(|token| matches!(token.kind(), TokenKind::Separator(_)))
.map(|token| {
Box::new(TerminatingSeparatorWarning {
expression: tokenized.expression().clone(),
span: (*token.annotation()).into(),
}) as BoxedDiagnostic
}),
)
}

// These tests exercise `Glob` APIs, which wrap functions in this module.
Expand Down

0 comments on commit 303b5d6

Please sign in to comment.