mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 21:13:37 +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"
|
||||
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"
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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() -> { ... }`
|
||||
|
|
Loading…
Reference in a new issue