diff options
| author | bors <bors@rust-lang.org> | 2023-11-24 17:14:28 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-11-24 17:14:28 +0000 |
| commit | 34cffbf1d75fb6b5cb6bc68a9854b20dc74f135d (patch) | |
| tree | 186f172150010546f3aec809865af80d012d10e4 | |
| parent | fec3828c5f28db2f400b4b21897f3e3fd8249ee3 (diff) | |
| parent | b68f5311b52d109cf813dff1268264d17af766ba (diff) | |
| download | rust-34cffbf1d75fb6b5cb6bc68a9854b20dc74f135d.tar.gz rust-34cffbf1d75fb6b5cb6bc68a9854b20dc74f135d.zip | |
Auto merge of #15960 - dtolnay-contrib:issomeand, r=lnicola
Replace `option.map(cond) == Some(true)` with `option.is_some_and(cond)` Extracted from https://github.com/rust-lang/rust/pull/118253.
| -rw-r--r-- | crates/ide-assists/src/handlers/toggle_ignore.rs | 2 | ||||
| -rw-r--r-- | crates/ide/src/extend_selection.rs | 2 | ||||
| -rw-r--r-- | crates/rust-analyzer/tests/slow-tests/tidy.rs | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/crates/ide-assists/src/handlers/toggle_ignore.rs b/crates/ide-assists/src/handlers/toggle_ignore.rs index b7d57f02be5..f864ee50c81 100644 --- a/crates/ide-assists/src/handlers/toggle_ignore.rs +++ b/crates/ide-assists/src/handlers/toggle_ignore.rs @@ -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)] diff --git a/crates/ide/src/extend_selection.rs b/crates/ide/src/extend_selection.rs index 3d89599c583..9b2ff070c74 100644 --- a/crates/ide/src/extend_selection.rs +++ b/crates/ide/src/extend_selection.rs @@ -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); } diff --git a/crates/rust-analyzer/tests/slow-tests/tidy.rs b/crates/rust-analyzer/tests/slow-tests/tidy.rs index 56b5fcef3c2..45adbf5c573 100644 --- a/crates/rust-analyzer/tests/slow-tests/tidy.rs +++ b/crates/rust-analyzer/tests/slow-tests/tidy.rs @@ -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) } } |
