aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/completion/test_utils.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-06-24 10:34:25 +0100
committerGitHub <[email protected]>2020-06-24 10:34:25 +0100
commit7c28d060b5a5c4e7004282aa6827c3023c5b03c8 (patch)
tree0ed66d422a10a9f192a039565ac70b85dbdf80f8 /crates/ra_ide/src/completion/test_utils.rs
parent15c71f881607db5ddfd759785f62e4ae44aaf301 (diff)
parentc749fe223bf5a41709a4bc91d0f56dafc4201658 (diff)
Merge #5021
5021: Reduce code dupication around fixtures r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide/src/completion/test_utils.rs')
-rw-r--r--crates/ra_ide/src/completion/test_utils.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/ra_ide/src/completion/test_utils.rs b/crates/ra_ide/src/completion/test_utils.rs
index 1e16a43ca..a1b7c1193 100644
--- a/crates/ra_ide/src/completion/test_utils.rs
+++ b/crates/ra_ide/src/completion/test_utils.rs
@@ -2,7 +2,7 @@
2 2
3use crate::{ 3use crate::{
4 completion::{completion_item::CompletionKind, CompletionConfig}, 4 completion::{completion_item::CompletionKind, CompletionConfig},
5 mock_analysis::{analysis_and_position, single_file_with_position}, 5 mock_analysis::analysis_and_position,
6 CompletionItem, 6 CompletionItem,
7}; 7};
8use hir::Semantics; 8use hir::Semantics;
@@ -33,7 +33,7 @@ fn get_all_completion_items(code: &str, options: &CompletionConfig) -> Vec<Compl
33 let (analysis, position) = if code.contains("//-") { 33 let (analysis, position) = if code.contains("//-") {
34 analysis_and_position(code) 34 analysis_and_position(code)
35 } else { 35 } else {
36 single_file_with_position(code) 36 analysis_and_position(code)
37 }; 37 };
38 analysis.completions(options, position).unwrap().unwrap().into() 38 analysis.completions(options, position).unwrap().unwrap().into()
39} 39}
@@ -55,7 +55,7 @@ pub(crate) fn completion_list_with_options(
55} 55}
56 56
57pub(crate) fn check_pattern_is_applicable(code: &str, check: fn(SyntaxElement) -> bool) { 57pub(crate) fn check_pattern_is_applicable(code: &str, check: fn(SyntaxElement) -> bool) {
58 let (analysis, pos) = single_file_with_position(code); 58 let (analysis, pos) = analysis_and_position(code);
59 analysis 59 analysis
60 .with_db(|db| { 60 .with_db(|db| {
61 let sema = Semantics::new(db); 61 let sema = Semantics::new(db);