Unnamed repository; edit this file 'description' to name the repository.
search_is_some
Johann Hemmann 2024-01-19
parent 71d4dba · commit 159b4c9
-rw-r--r--Cargo.toml1
-rw-r--r--crates/hir-def/src/resolver.rs3
-rw-r--r--crates/ide/src/typing.rs17
3 files changed, 8 insertions, 13 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 32e9fb28b2..e7ee98512f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -177,7 +177,6 @@ needless_doctest_main = "allow"
new_without_default = "allow"
non_canonical_clone_impl = "allow"
non_canonical_partial_ord_impl = "allow"
-search_is_some = "allow"
self_named_constructors = "allow"
single_match = "allow"
skip_while_next = "allow"
diff --git a/crates/hir-def/src/resolver.rs b/crates/hir-def/src/resolver.rs
index 61117141f0..7a9c4ea016 100644
--- a/crates/hir-def/src/resolver.rs
+++ b/crates/hir-def/src/resolver.rs
@@ -239,8 +239,7 @@ impl Resolver {
db: &dyn DefDatabase,
visibility: &RawVisibility,
) -> Option<Visibility> {
- let within_impl =
- self.scopes().find(|scope| matches!(scope, Scope::ImplDefScope(_))).is_some();
+ let within_impl = self.scopes().any(|scope| matches!(scope, Scope::ImplDefScope(_)));
match visibility {
RawVisibility::Module(_, _) => {
let (item_map, module) = self.item_scope();
diff --git a/crates/ide/src/typing.rs b/crates/ide/src/typing.rs
index b4a2dc28bb..b8856882ed 100644
--- a/crates/ide/src/typing.rs
+++ b/crates/ide/src/typing.rs
@@ -359,19 +359,16 @@ fn on_left_angle_typed(file: &SourceFile, offset: TextSize) -> Option<ExtendedTe
}
}
- if ancestors_at_offset(file.syntax(), offset)
- .find(|n| {
- ast::GenericParamList::can_cast(n.kind()) || ast::GenericArgList::can_cast(n.kind())
- })
- .is_some()
- {
- return Some(ExtendedTextEdit {
+ if ancestors_at_offset(file.syntax(), offset).any(|n| {
+ ast::GenericParamList::can_cast(n.kind()) || ast::GenericArgList::can_cast(n.kind())
+ }) {
+ Some(ExtendedTextEdit {
edit: TextEdit::replace(range, "<$0>".to_string()),
is_snippet: true,
- });
+ })
+ } else {
+ None
}
-
- None
}
/// Adds a space after an arrow when `fn foo() { ... }` is turned into `fn foo() -> { ... }`