From 4e3e8d1ab265e9d0024cd33f2f3b8c2a8b31265d Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 27 Jun 2020 12:07:48 +0200 Subject: cleanup --- crates/ra_ide/src/completion/test_utils.rs | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/crates/ra_ide/src/completion/test_utils.rs b/crates/ra_ide/src/completion/test_utils.rs index a1b7c1193..5c01654cc 100644 --- a/crates/ra_ide/src/completion/test_utils.rs +++ b/crates/ra_ide/src/completion/test_utils.rs @@ -1,21 +1,18 @@ //! Runs completion for testing purposes. +use hir::Semantics; +use ra_syntax::{AstNode, NodeOrToken, SyntaxElement}; + use crate::{ completion::{completion_item::CompletionKind, CompletionConfig}, mock_analysis::analysis_and_position, CompletionItem, }; -use hir::Semantics; -use ra_syntax::{AstNode, NodeOrToken, SyntaxElement}; pub(crate) fn do_completion(code: &str, kind: CompletionKind) -> Vec { do_completion_with_options(code, kind, &CompletionConfig::default()) } -pub(crate) fn completion_list(code: &str, kind: CompletionKind) -> String { - completion_list_with_options(code, kind, &CompletionConfig::default()) -} - pub(crate) fn do_completion_with_options( code: &str, kind: CompletionKind, @@ -29,13 +26,8 @@ pub(crate) fn do_completion_with_options( kind_completions } -fn get_all_completion_items(code: &str, options: &CompletionConfig) -> Vec { - let (analysis, position) = if code.contains("//-") { - analysis_and_position(code) - } else { - analysis_and_position(code) - }; - analysis.completions(options, position).unwrap().unwrap().into() +pub(crate) fn completion_list(code: &str, kind: CompletionKind) -> String { + completion_list_with_options(code, kind, &CompletionConfig::default()) } pub(crate) fn completion_list_with_options( @@ -65,3 +57,8 @@ pub(crate) fn check_pattern_is_applicable(code: &str, check: fn(SyntaxElement) - }) .unwrap(); } + +fn get_all_completion_items(code: &str, options: &CompletionConfig) -> Vec { + let (analysis, position) = analysis_and_position(code); + analysis.completions(options, position).unwrap().unwrap().into() +} -- cgit v1.2.3