mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-28 05:53:45 +00:00
search_is_some
This commit is contained in:
parent
71d4dba960
commit
159b4c9fe9
3 changed files with 8 additions and 13 deletions
|
@ -177,7 +177,6 @@ needless_doctest_main = "allow"
|
||||||
new_without_default = "allow"
|
new_without_default = "allow"
|
||||||
non_canonical_clone_impl = "allow"
|
non_canonical_clone_impl = "allow"
|
||||||
non_canonical_partial_ord_impl = "allow"
|
non_canonical_partial_ord_impl = "allow"
|
||||||
search_is_some = "allow"
|
|
||||||
self_named_constructors = "allow"
|
self_named_constructors = "allow"
|
||||||
single_match = "allow"
|
single_match = "allow"
|
||||||
skip_while_next = "allow"
|
skip_while_next = "allow"
|
||||||
|
|
|
@ -239,8 +239,7 @@ impl Resolver {
|
||||||
db: &dyn DefDatabase,
|
db: &dyn DefDatabase,
|
||||||
visibility: &RawVisibility,
|
visibility: &RawVisibility,
|
||||||
) -> Option<Visibility> {
|
) -> Option<Visibility> {
|
||||||
let within_impl =
|
let within_impl = self.scopes().any(|scope| matches!(scope, Scope::ImplDefScope(_)));
|
||||||
self.scopes().find(|scope| matches!(scope, Scope::ImplDefScope(_))).is_some();
|
|
||||||
match visibility {
|
match visibility {
|
||||||
RawVisibility::Module(_, _) => {
|
RawVisibility::Module(_, _) => {
|
||||||
let (item_map, module) = self.item_scope();
|
let (item_map, module) = self.item_scope();
|
||||||
|
|
|
@ -359,19 +359,16 @@ fn on_left_angle_typed(file: &SourceFile, offset: TextSize) -> Option<ExtendedTe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ancestors_at_offset(file.syntax(), offset)
|
if ancestors_at_offset(file.syntax(), offset).any(|n| {
|
||||||
.find(|n| {
|
ast::GenericParamList::can_cast(n.kind()) || ast::GenericArgList::can_cast(n.kind())
|
||||||
ast::GenericParamList::can_cast(n.kind()) || ast::GenericArgList::can_cast(n.kind())
|
}) {
|
||||||
})
|
Some(ExtendedTextEdit {
|
||||||
.is_some()
|
|
||||||
{
|
|
||||||
return Some(ExtendedTextEdit {
|
|
||||||
edit: TextEdit::replace(range, "<$0>".to_string()),
|
edit: TextEdit::replace(range, "<$0>".to_string()),
|
||||||
is_snippet: true,
|
is_snippet: true,
|
||||||
});
|
})
|
||||||
|
} else {
|
||||||
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
None
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Adds a space after an arrow when `fn foo() { ... }` is turned into `fn foo() -> { ... }`
|
/// Adds a space after an arrow when `fn foo() { ... }` is turned into `fn foo() -> { ... }`
|
||||||
|
|
Loading…
Reference in a new issue