search_is_some

This commit is contained in:
Johann Hemmann 2024-01-19 17:52:55 +01:00
parent 71d4dba960
commit 159b4c9fe9
3 changed files with 8 additions and 13 deletions

View file

@ -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"

View file

@ -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();

View file

@ -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() -> { ... }`