From 6f573bd84f4564f11b08db720401ae16a0f42f2f Mon Sep 17 00:00:00 2001 From: Igor Aleksanov Date: Sat, 17 Oct 2020 11:03:07 +0300 Subject: Allow hints after 'fn' keyword if it's an impl trait block --- crates/ide/src/completion/test_utils.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'crates/ide/src/completion/test_utils.rs') diff --git a/crates/ide/src/completion/test_utils.rs b/crates/ide/src/completion/test_utils.rs index feb8cd2a6..dabbef888 100644 --- a/crates/ide/src/completion/test_utils.rs +++ b/crates/ide/src/completion/test_utils.rs @@ -104,6 +104,18 @@ pub(crate) fn check_pattern_is_applicable(code: &str, check: fn(SyntaxElement) - .unwrap(); } +pub(crate) fn check_pattern_is_not_applicable(code: &str, check: fn(SyntaxElement) -> bool) { + let (analysis, pos) = fixture::position(code); + analysis + .with_db(|db| { + let sema = Semantics::new(db); + let original_file = sema.parse(pos.file_id); + let token = original_file.syntax().token_at_offset(pos.offset).left_biased().unwrap(); + assert!(!check(NodeOrToken::Token(token))); + }) + .unwrap(); +} + pub(crate) fn get_all_completion_items( config: CompletionConfig, code: &str, -- cgit v1.2.3