From 159b4c9fe9da6193b58dc01d213f04603e3509ec Mon Sep 17 00:00:00 2001 From: Johann Hemmann Date: Fri, 19 Jan 2024 17:52:55 +0100 Subject: [PATCH] search_is_some --- Cargo.toml | 1 - crates/hir-def/src/resolver.rs | 3 +-- crates/ide/src/typing.rs | 17 +++++++---------- 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 { - 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".to_string()), is_snippet: true, - }); + }) + } else { + None } - - None } /// Adds a space after an arrow when `fn foo() { ... }` is turned into `fn foo() -> { ... }`