Skip to content

Commit 159b4c9

Browse files
committed
search_is_some
1 parent 71d4dba commit 159b4c9

File tree

3 files changed

+8
-13
lines changed

3 files changed

+8
-13
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ needless_doctest_main = "allow"
177177
new_without_default = "allow"
178178
non_canonical_clone_impl = "allow"
179179
non_canonical_partial_ord_impl = "allow"
180-
search_is_some = "allow"
181180
self_named_constructors = "allow"
182181
single_match = "allow"
183182
skip_while_next = "allow"

crates/hir-def/src/resolver.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,7 @@ impl Resolver {
239239
db: &dyn DefDatabase,
240240
visibility: &RawVisibility,
241241
) -> Option<Visibility> {
242-
let within_impl =
243-
self.scopes().find(|scope| matches!(scope, Scope::ImplDefScope(_))).is_some();
242+
let within_impl = self.scopes().any(|scope| matches!(scope, Scope::ImplDefScope(_)));
244243
match visibility {
245244
RawVisibility::Module(_, _) => {
246245
let (item_map, module) = self.item_scope();

crates/ide/src/typing.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -359,19 +359,16 @@ fn on_left_angle_typed(file: &SourceFile, offset: TextSize) -> Option<ExtendedTe
359359
}
360360
}
361361

362-
if ancestors_at_offset(file.syntax(), offset)
363-
.find(|n| {
364-
ast::GenericParamList::can_cast(n.kind()) || ast::GenericArgList::can_cast(n.kind())
365-
})
366-
.is_some()
367-
{
368-
return Some(ExtendedTextEdit {
362+
if ancestors_at_offset(file.syntax(), offset).any(|n| {
363+
ast::GenericParamList::can_cast(n.kind()) || ast::GenericArgList::can_cast(n.kind())
364+
}) {
365+
Some(ExtendedTextEdit {
369366
edit: TextEdit::replace(range, "<$0>".to_string()),
370367
is_snippet: true,
371-
});
368+
})
369+
} else {
370+
None
372371
}
373-
374-
None
375372
}
376373

377374
/// Adds a space after an arrow when `fn foo() { ... }` is turned into `fn foo() -> { ... }`

0 commit comments

Comments
 (0)