aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide')
-rw-r--r--crates/ra_ide/src/completion/complete_record.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/crates/ra_ide/src/completion/complete_record.rs b/crates/ra_ide/src/completion/complete_record.rs
index 01dd8c6db..780a98aea 100644
--- a/crates/ra_ide/src/completion/complete_record.rs
+++ b/crates/ra_ide/src/completion/complete_record.rs
@@ -1,7 +1,8 @@
1//! Complete fields in record literals and patterns. 1//! Complete fields in record literals and patterns.
2use crate::completion::{CompletionContext, Completions};
3use ra_syntax::{ast, ast::NameOwner, SmolStr}; 2use ra_syntax::{ast, ast::NameOwner, SmolStr};
4 3
4use crate::completion::{CompletionContext, Completions};
5
5pub(super) fn complete_record(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> { 6pub(super) fn complete_record(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> {
6 let (ty, variant, already_present_fields) = 7 let (ty, variant, already_present_fields) =
7 match (ctx.record_lit_pat.as_ref(), ctx.record_lit_syntax.as_ref()) { 8 match (ctx.record_lit_pat.as_ref(), ctx.record_lit_syntax.as_ref()) {
@@ -59,9 +60,10 @@ fn pattern_ascribed_fields(record_pat: &ast::RecordPat) -> Vec<SmolStr> {
59#[cfg(test)] 60#[cfg(test)]
60mod tests { 61mod tests {
61 mod record_lit_tests { 62 mod record_lit_tests {
62 use crate::completion::{test_utils::do_completion, CompletionItem, CompletionKind};
63 use insta::assert_debug_snapshot; 63 use insta::assert_debug_snapshot;
64 64
65 use crate::completion::{test_utils::do_completion, CompletionItem, CompletionKind};
66
65 fn complete(code: &str) -> Vec<CompletionItem> { 67 fn complete(code: &str) -> Vec<CompletionItem> {
66 do_completion(code, CompletionKind::Reference) 68 do_completion(code, CompletionKind::Reference)
67 } 69 }
@@ -204,9 +206,10 @@ mod tests {
204 } 206 }
205 207
206 mod record_pat_tests { 208 mod record_pat_tests {
207 use crate::completion::{test_utils::do_completion, CompletionItem, CompletionKind};
208 use insta::assert_debug_snapshot; 209 use insta::assert_debug_snapshot;
209 210
211 use crate::completion::{test_utils::do_completion, CompletionItem, CompletionKind};
212
210 fn complete(code: &str) -> Vec<CompletionItem> { 213 fn complete(code: &str) -> Vec<CompletionItem> {
211 do_completion(code, CompletionKind::Reference) 214 do_completion(code, CompletionKind::Reference)
212 } 215 }