diff options
author | Lukas Wirth <[email protected]> | 2021-05-27 02:01:46 +0100 |
---|---|---|
committer | Lukas Wirth <[email protected]> | 2021-05-27 02:15:48 +0100 |
commit | 6ec4ea8d9eb9ad6ad8b91968bde09121b5b791a0 (patch) | |
tree | e8750a920f92bbbd4fe3cb23be585eed7ad92b24 /crates/ide_completion/src/context.rs | |
parent | 7de925b8abcf0d26869dc96f346510af61663edf (diff) |
simplify
Diffstat (limited to 'crates/ide_completion/src/context.rs')
-rw-r--r-- | crates/ide_completion/src/context.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/crates/ide_completion/src/context.rs b/crates/ide_completion/src/context.rs index dfac8f29f..5d15fde2f 100644 --- a/crates/ide_completion/src/context.rs +++ b/crates/ide_completion/src/context.rs | |||
@@ -18,9 +18,8 @@ use text_edit::Indel; | |||
18 | use crate::{ | 18 | use crate::{ |
19 | patterns::{ | 19 | patterns::{ |
20 | for_is_prev2, has_bind_pat_parent, has_block_expr_parent, has_field_list_parent, | 20 | for_is_prev2, has_bind_pat_parent, has_block_expr_parent, has_field_list_parent, |
21 | has_impl_as_prev_sibling, has_impl_parent, has_item_list_or_source_file_parent, | 21 | has_impl_parent, has_item_list_or_source_file_parent, has_prev_sibling, has_ref_parent, |
22 | has_ref_parent, has_trait_as_prev_sibling, has_trait_parent, inside_impl_trait_block, | 22 | has_trait_parent, inside_impl_trait_block, is_in_loop_body, is_match_arm, previous_token, |
23 | is_in_loop_body, is_match_arm, previous_token, | ||
24 | }, | 23 | }, |
25 | CompletionConfig, | 24 | CompletionConfig, |
26 | }; | 25 | }; |
@@ -44,7 +43,7 @@ pub(crate) enum ImmediateLocation { | |||
44 | } | 43 | } |
45 | 44 | ||
46 | #[derive(Copy, Clone, Debug, PartialEq, Eq)] | 45 | #[derive(Copy, Clone, Debug, PartialEq, Eq)] |
47 | pub enum PrevSibling { | 46 | pub(crate) enum PrevSibling { |
48 | Trait, | 47 | Trait, |
49 | Impl, | 48 | Impl, |
50 | } | 49 | } |
@@ -323,9 +322,9 @@ impl<'a> CompletionContext<'a> { | |||
323 | self.previous_token = previous_token(syntax_element.clone()); | 322 | self.previous_token = previous_token(syntax_element.clone()); |
324 | self.in_loop_body = is_in_loop_body(syntax_element.clone()); | 323 | self.in_loop_body = is_in_loop_body(syntax_element.clone()); |
325 | self.is_match_arm = is_match_arm(syntax_element.clone()); | 324 | self.is_match_arm = is_match_arm(syntax_element.clone()); |
326 | if has_impl_as_prev_sibling(syntax_element.clone()) { | 325 | if has_prev_sibling(syntax_element.clone(), IMPL) { |
327 | self.prev_sibling = Some(PrevSibling::Impl) | 326 | self.prev_sibling = Some(PrevSibling::Impl) |
328 | } else if has_trait_as_prev_sibling(syntax_element.clone()) { | 327 | } else if has_prev_sibling(syntax_element.clone(), TRAIT) { |
329 | self.prev_sibling = Some(PrevSibling::Trait) | 328 | self.prev_sibling = Some(PrevSibling::Trait) |
330 | } | 329 | } |
331 | 330 | ||