Skip to content

Commit b68f531

Browse files
committed
Replace option.map(cond) == Some(true) with option.is_some_and(cond)
1 parent fec3828 commit b68f531

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

Diff for: crates/ide-assists/src/handlers/toggle_ignore.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub(crate) fn toggle_ignore(acc: &mut Assists, ctx: &AssistContext<'_>) -> Optio
5555
}
5656

5757
fn has_ignore_attribute(fn_def: &ast::Fn) -> Option<ast::Attr> {
58-
fn_def.attrs().find(|attr| attr.path().map(|it| it.syntax().text() == "ignore") == Some(true))
58+
fn_def.attrs().find(|attr| attr.path().is_some_and(|it| it.syntax().text() == "ignore"))
5959
}
6060

6161
#[cfg(test)]

Diff for: crates/ide/src/extend_selection.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ fn try_extend_selection(
108108

109109
let node = shallowest_node(&node);
110110

111-
if node.parent().map(|n| list_kinds.contains(&n.kind())) == Some(true) {
111+
if node.parent().is_some_and(|n| list_kinds.contains(&n.kind())) {
112112
if let Some(range) = extend_list_item(&node) {
113113
return Some(range);
114114
}

Diff for: crates/rust-analyzer/tests/slow-tests/tidy.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ fn check_trailing_ws(path: &Path, text: &str) {
316316
return;
317317
}
318318
for (line_number, line) in text.lines().enumerate() {
319-
if line.chars().last().map(char::is_whitespace) == Some(true) {
319+
if line.chars().last().is_some_and(char::is_whitespace) {
320320
panic!("Trailing whitespace in {} at line {}", path.display(), line_number + 1)
321321
}
322322
}

0 commit comments

Comments
 (0)