Skip to content

Commit

Permalink
Auto merge of #15960 - dtolnay-contrib:issomeand, r=lnicola
Browse files Browse the repository at this point in the history
Replace `option.map(cond) == Some(true)` with `option.is_some_and(cond)`

Extracted from rust-lang/rust#118253.
  • Loading branch information
bors committed Nov 24, 2023
2 parents fec3828 + b68f531 commit 34cffbf
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion crates/ide-assists/src/handlers/toggle_ignore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub(crate) fn toggle_ignore(acc: &mut Assists, ctx: &AssistContext<'_>) -> Optio
}

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

#[cfg(test)]
Expand Down
2 changes: 1 addition & 1 deletion crates/ide/src/extend_selection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ fn try_extend_selection(

let node = shallowest_node(&node);

if node.parent().map(|n| list_kinds.contains(&n.kind())) == Some(true) {
if node.parent().is_some_and(|n| list_kinds.contains(&n.kind())) {
if let Some(range) = extend_list_item(&node) {
return Some(range);
}
Expand Down
2 changes: 1 addition & 1 deletion crates/rust-analyzer/tests/slow-tests/tidy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ fn check_trailing_ws(path: &Path, text: &str) {
return;
}
for (line_number, line) in text.lines().enumerate() {
if line.chars().last().map(char::is_whitespace) == Some(true) {
if line.chars().last().is_some_and(char::is_whitespace) {
panic!("Trailing whitespace in {} at line {}", path.display(), line_number + 1)
}
}
Expand Down

0 comments on commit 34cffbf

Please sign in to comment.