Skip to content

Commit 0885d91

Browse files
committed
Use is_some_and and is_none_or
1 parent ff153e4 commit 0885d91

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/formatter.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,9 @@ impl<'a> Formatter<'a> {
165165

166166
fn format_line_comment(&mut self, token: &Token<'_>, query: &mut String) {
167167
let is_whitespace_followed_by_special_token =
168-
self.next_token(1).map_or(false, |current_token| {
168+
self.next_token(1).is_some_and(|current_token| {
169169
current_token.kind == TokenKind::Whitespace
170-
&& self.next_token(2).map_or(false, |next_token| {
170+
&& self.next_token(2).is_some_and(|next_token| {
171171
!matches!(next_token.kind, TokenKind::Operator)
172172
})
173173
});
@@ -210,7 +210,7 @@ impl<'a> Formatter<'a> {
210210
true,
211211
self.options
212212
.max_inline_top_level
213-
.map_or(true, |limit| limit < span_len),
213+
.is_none_or(|limit| limit < span_len),
214214
)
215215
}
216216
}
@@ -253,7 +253,7 @@ impl<'a> Formatter<'a> {
253253
&& self
254254
.options
255255
.max_inline_arguments
256-
.map_or(true, |limit| limit < self.indentation.span())
256+
.is_none_or(|limit| limit < self.indentation.span())
257257
{
258258
self.add_new_line(query);
259259
} else {

src/params.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ impl<'a> Params<'a> {
1212
}
1313

1414
pub fn get(&mut self, token: &'a Token<'a>) -> &'a str {
15-
let named_placeholder_token = token.key.as_ref().map_or(false, |key| key.named() != "");
15+
let named_placeholder_token = token.key.as_ref().is_some_and(|key| key.named() != "");
1616

1717
match self.params {
1818
QueryParams::Named(params) => token

0 commit comments

Comments
 (0)