From 0f6c048ce1a621ccd3e2080ec5aafbd053c516f4 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 29 Aug 2019 16:49:10 +0300 Subject: :arrow_up: insta --- crates/ra_ide_api/src/completion/complete_dot.rs | 28 ++++++++++---------- .../ra_ide_api/src/completion/complete_fn_param.rs | 8 +++--- .../ra_ide_api/src/completion/complete_keyword.rs | 28 ++++++++++---------- crates/ra_ide_api/src/completion/complete_path.rs | 30 +++++++++++----------- .../ra_ide_api/src/completion/complete_pattern.rs | 4 +-- .../ra_ide_api/src/completion/complete_postfix.rs | 6 ++--- .../src/completion/complete_record_literal.rs | 10 ++++---- .../src/completion/complete_record_pattern.rs | 6 ++--- crates/ra_ide_api/src/completion/complete_scope.rs | 26 +++++++++---------- .../ra_ide_api/src/completion/complete_snippet.rs | 10 ++++---- crates/ra_ide_api/src/completion/presentation.rs | 14 +++++----- 11 files changed, 85 insertions(+), 85 deletions(-) (limited to 'crates/ra_ide_api/src/completion') diff --git a/crates/ra_ide_api/src/completion/complete_dot.rs b/crates/ra_ide_api/src/completion/complete_dot.rs index 27256f879..2325cdf08 100644 --- a/crates/ra_ide_api/src/completion/complete_dot.rs +++ b/crates/ra_ide_api/src/completion/complete_dot.rs @@ -68,7 +68,7 @@ fn complete_methods(acc: &mut Completions, ctx: &CompletionContext, receiver: Ty #[cfg(test)] mod tests { use crate::completion::{do_completion, CompletionItem, CompletionKind}; - use insta::assert_debug_snapshot_matches; + use insta::assert_debug_snapshot; fn do_ref_completion(code: &str) -> Vec { do_completion(code, CompletionKind::Reference) @@ -76,7 +76,7 @@ mod tests { #[test] fn test_struct_field_completion() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_ref_completion( r" struct A { the_field: u32 } @@ -102,7 +102,7 @@ mod tests { #[test] fn test_struct_field_completion_self() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_ref_completion( r" struct A { @@ -144,7 +144,7 @@ mod tests { #[test] fn test_struct_field_completion_autoderef() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_ref_completion( r" struct A { the_field: (u32, i32) } @@ -180,7 +180,7 @@ mod tests { #[test] fn test_no_struct_field_completion_for_method_call() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_ref_completion( r" struct A { the_field: u32 } @@ -195,7 +195,7 @@ mod tests { #[test] fn test_method_completion() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_ref_completion( r" struct A {} @@ -224,7 +224,7 @@ mod tests { #[test] fn test_trait_method_completion() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_ref_completion( r" struct A {} @@ -252,7 +252,7 @@ mod tests { #[test] fn test_trait_method_completion_deduplicated() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_ref_completion( r" struct A {} @@ -280,7 +280,7 @@ mod tests { #[test] fn test_no_non_self_method() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_ref_completion( r" struct A {} @@ -298,7 +298,7 @@ mod tests { #[test] fn test_method_attr_filtering() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_ref_completion( r" struct A {} @@ -331,7 +331,7 @@ mod tests { #[test] fn test_tuple_field_completion() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_ref_completion( r" fn foo() { @@ -365,7 +365,7 @@ mod tests { #[test] fn test_tuple_field_inference() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_ref_completion( r" pub struct S; @@ -400,7 +400,7 @@ mod tests { #[test] fn test_completion_works_in_consts() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_ref_completion( r" struct A { the_field: u32 } @@ -426,7 +426,7 @@ mod tests { #[test] fn test_completion_await_impls_future() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_completion( r###" //- /main.rs diff --git a/crates/ra_ide_api/src/completion/complete_fn_param.rs b/crates/ra_ide_api/src/completion/complete_fn_param.rs index 0887ef1f6..6639b6fff 100644 --- a/crates/ra_ide_api/src/completion/complete_fn_param.rs +++ b/crates/ra_ide_api/src/completion/complete_fn_param.rs @@ -51,7 +51,7 @@ pub(super) fn complete_fn_param(acc: &mut Completions, ctx: &CompletionContext) #[cfg(test)] mod tests { use crate::completion::{do_completion, CompletionItem, CompletionKind}; - use insta::assert_debug_snapshot_matches; + use insta::assert_debug_snapshot; fn do_magic_completion(code: &str) -> Vec { do_completion(code, CompletionKind::Magic) @@ -59,7 +59,7 @@ mod tests { #[test] fn test_param_completion_last_param() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_magic_completion( r" fn foo(file_id: FileId) {} @@ -83,7 +83,7 @@ mod tests { #[test] fn test_param_completion_nth_param() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_magic_completion( r" fn foo(file_id: FileId) {} @@ -107,7 +107,7 @@ mod tests { #[test] fn test_param_completion_trait_param() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_magic_completion( r" pub(crate) trait SourceRoot { diff --git a/crates/ra_ide_api/src/completion/complete_keyword.rs b/crates/ra_ide_api/src/completion/complete_keyword.rs index 18c1839dc..c527a9f63 100644 --- a/crates/ra_ide_api/src/completion/complete_keyword.rs +++ b/crates/ra_ide_api/src/completion/complete_keyword.rs @@ -113,7 +113,7 @@ fn complete_return( #[cfg(test)] mod tests { use crate::completion::{do_completion, CompletionItem, CompletionKind}; - use insta::assert_debug_snapshot_matches; + use insta::assert_debug_snapshot; fn do_keyword_completion(code: &str) -> Vec { do_completion(code, CompletionKind::Keyword) @@ -121,7 +121,7 @@ mod tests { #[test] fn completes_keywords_in_use_stmt() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_keyword_completion( r" use <|> @@ -152,7 +152,7 @@ mod tests { ]"### ); - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_keyword_completion( r" use a::<|> @@ -176,7 +176,7 @@ mod tests { ]"### ); - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_keyword_completion( r" use a::{b, <|>} @@ -203,7 +203,7 @@ mod tests { #[test] fn completes_various_keywords_in_function() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_keyword_completion( r" fn quux() { @@ -253,7 +253,7 @@ mod tests { #[test] fn completes_else_after_if() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_keyword_completion( r" fn quux() { @@ -319,7 +319,7 @@ mod tests { #[test] fn test_completion_return_value() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_keyword_completion( r" fn quux() -> i32 { @@ -366,7 +366,7 @@ mod tests { }, ]"### ); - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_keyword_completion( r" fn quux() { @@ -417,7 +417,7 @@ mod tests { #[test] fn dont_add_semi_after_return_if_not_a_statement() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_keyword_completion( r" fn quux() -> i32 { @@ -469,7 +469,7 @@ mod tests { #[test] fn last_return_in_block_has_semi() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_keyword_completion( r" fn quux() -> i32 { @@ -517,7 +517,7 @@ mod tests { }, ]"### ); - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_keyword_completion( r" fn quux() -> i32 { @@ -571,7 +571,7 @@ mod tests { #[test] fn completes_break_and_continue_in_loops() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_keyword_completion( r" fn quux() -> i32 { @@ -633,7 +633,7 @@ mod tests { ); // No completion: lambda isolates control flow - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_keyword_completion( r" fn quux() -> i32 { @@ -683,7 +683,7 @@ mod tests { #[test] fn no_semi_after_break_continue_in_expr() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_keyword_completion( r" fn f() { diff --git a/crates/ra_ide_api/src/completion/complete_path.rs b/crates/ra_ide_api/src/completion/complete_path.rs index 5fd41eeb3..d6b5ac9ad 100644 --- a/crates/ra_ide_api/src/completion/complete_path.rs +++ b/crates/ra_ide_api/src/completion/complete_path.rs @@ -79,7 +79,7 @@ mod tests { use test_utils::covers; use crate::completion::{do_completion, CompletionItem, CompletionKind}; - use insta::assert_debug_snapshot_matches; + use insta::assert_debug_snapshot; fn do_reference_completion(code: &str) -> Vec { do_completion(code, CompletionKind::Reference) @@ -120,7 +120,7 @@ mod tests { #[test] fn completes_mod_with_docs() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( r" use self::my<|>; @@ -149,7 +149,7 @@ mod tests { #[test] fn completes_use_item_starting_with_self() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( r" use self::m::<|>; @@ -173,7 +173,7 @@ mod tests { #[test] fn completes_use_item_starting_with_crate() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( " //- /lib.rs @@ -204,7 +204,7 @@ mod tests { #[test] fn completes_nested_use_tree() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( " //- /lib.rs @@ -235,7 +235,7 @@ mod tests { #[test] fn completes_deeply_nested_use_tree() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( " //- /lib.rs @@ -263,7 +263,7 @@ mod tests { #[test] fn completes_enum_variant() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( " //- /lib.rs @@ -306,7 +306,7 @@ mod tests { #[test] fn completes_enum_variant_with_details() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( " //- /lib.rs @@ -363,7 +363,7 @@ mod tests { #[test] fn completes_struct_associated_method() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( " //- /lib.rs @@ -396,7 +396,7 @@ mod tests { #[test] fn completes_struct_associated_const() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( " //- /lib.rs @@ -429,7 +429,7 @@ mod tests { #[test] fn completes_struct_associated_type() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( " //- /lib.rs @@ -462,7 +462,7 @@ mod tests { #[test] fn completes_enum_associated_method() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( " //- /lib.rs @@ -495,7 +495,7 @@ mod tests { #[test] fn completes_union_associated_method() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( " //- /lib.rs @@ -528,7 +528,7 @@ mod tests { #[test] fn completes_use_paths_across_crates() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( " //- /main.rs @@ -554,7 +554,7 @@ mod tests { #[test] fn completes_type_alias() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( " struct S; diff --git a/crates/ra_ide_api/src/completion/complete_pattern.rs b/crates/ra_ide_api/src/completion/complete_pattern.rs index f12dfcc17..fb02844fa 100644 --- a/crates/ra_ide_api/src/completion/complete_pattern.rs +++ b/crates/ra_ide_api/src/completion/complete_pattern.rs @@ -28,7 +28,7 @@ pub(super) fn complete_pattern(acc: &mut Completions, ctx: &CompletionContext) { #[cfg(test)] mod tests { use crate::completion::{do_completion, CompletionItem, CompletionKind}; - use insta::assert_debug_snapshot_matches; + use insta::assert_debug_snapshot; fn complete(code: &str) -> Vec { do_completion(code, CompletionKind::Reference) @@ -53,7 +53,7 @@ mod tests { } ", ); - assert_debug_snapshot_matches!(completions, @r###" + assert_debug_snapshot!(completions, @r###" ⋮[ ⋮ CompletionItem { ⋮ label: "E", diff --git a/crates/ra_ide_api/src/completion/complete_postfix.rs b/crates/ra_ide_api/src/completion/complete_postfix.rs index 6d834f6ce..3970d1af3 100644 --- a/crates/ra_ide_api/src/completion/complete_postfix.rs +++ b/crates/ra_ide_api/src/completion/complete_postfix.rs @@ -72,7 +72,7 @@ pub(super) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) { #[cfg(test)] mod tests { use crate::completion::{do_completion, CompletionItem, CompletionKind}; - use insta::assert_debug_snapshot_matches; + use insta::assert_debug_snapshot; fn do_postfix_completion(code: &str) -> Vec { do_completion(code, CompletionKind::Postfix) @@ -80,7 +80,7 @@ mod tests { #[test] fn postfix_completion_works_for_trivial_path_expression() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_postfix_completion( r#" fn main() { @@ -152,7 +152,7 @@ mod tests { #[test] fn some_postfix_completions_ignored() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_postfix_completion( r#" fn main() { diff --git a/crates/ra_ide_api/src/completion/complete_record_literal.rs b/crates/ra_ide_api/src/completion/complete_record_literal.rs index 6b929a8ac..ed4029964 100644 --- a/crates/ra_ide_api/src/completion/complete_record_literal.rs +++ b/crates/ra_ide_api/src/completion/complete_record_literal.rs @@ -23,7 +23,7 @@ pub(super) fn complete_record_literal(acc: &mut Completions, ctx: &CompletionCon #[cfg(test)] mod tests { use crate::completion::{do_completion, CompletionItem, CompletionKind}; - use insta::assert_debug_snapshot_matches; + use insta::assert_debug_snapshot; fn complete(code: &str) -> Vec { do_completion(code, CompletionKind::Reference) @@ -39,7 +39,7 @@ mod tests { } ", ); - assert_debug_snapshot_matches!(completions, @r###" + assert_debug_snapshot!(completions, @r###" ⋮[ ⋮ CompletionItem { ⋮ label: "the_field", @@ -65,7 +65,7 @@ mod tests { } ", ); - assert_debug_snapshot_matches!(completions, @r###" + assert_debug_snapshot!(completions, @r###" ⋮[ ⋮ CompletionItem { ⋮ label: "a", @@ -91,7 +91,7 @@ mod tests { } ", ); - assert_debug_snapshot_matches!(completions, @r###" + assert_debug_snapshot!(completions, @r###" ⋮[ ⋮ CompletionItem { ⋮ label: "b", @@ -116,7 +116,7 @@ mod tests { } ", ); - assert_debug_snapshot_matches!(completions, @r###" + assert_debug_snapshot!(completions, @r###" ⋮[ ⋮ CompletionItem { ⋮ label: "a", diff --git a/crates/ra_ide_api/src/completion/complete_record_pattern.rs b/crates/ra_ide_api/src/completion/complete_record_pattern.rs index 8c8b47ea4..70716b3d6 100644 --- a/crates/ra_ide_api/src/completion/complete_record_pattern.rs +++ b/crates/ra_ide_api/src/completion/complete_record_pattern.rs @@ -22,7 +22,7 @@ pub(super) fn complete_record_pattern(acc: &mut Completions, ctx: &CompletionCon #[cfg(test)] mod tests { use crate::completion::{do_completion, CompletionItem, CompletionKind}; - use insta::assert_debug_snapshot_matches; + use insta::assert_debug_snapshot; fn complete(code: &str) -> Vec { do_completion(code, CompletionKind::Reference) @@ -41,7 +41,7 @@ mod tests { } ", ); - assert_debug_snapshot_matches!(completions, @r###" + assert_debug_snapshot!(completions, @r###" ⋮[ ⋮ CompletionItem { ⋮ label: "foo", @@ -70,7 +70,7 @@ mod tests { } ", ); - assert_debug_snapshot_matches!(completions, @r###" + assert_debug_snapshot!(completions, @r###" ⋮[ ⋮ CompletionItem { ⋮ label: "bar", diff --git a/crates/ra_ide_api/src/completion/complete_scope.rs b/crates/ra_ide_api/src/completion/complete_scope.rs index 2000d953a..d6a44c3e0 100644 --- a/crates/ra_ide_api/src/completion/complete_scope.rs +++ b/crates/ra_ide_api/src/completion/complete_scope.rs @@ -122,7 +122,7 @@ impl ImportResolver { #[cfg(test)] mod tests { use crate::completion::{do_completion, CompletionItem, CompletionKind}; - use insta::assert_debug_snapshot_matches; + use insta::assert_debug_snapshot; fn do_reference_completion(code: &str) -> Vec { do_completion(code, CompletionKind::Reference) @@ -130,7 +130,7 @@ mod tests { #[test] fn completes_bindings_from_let() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( r" fn quux(x: i32) { @@ -171,7 +171,7 @@ mod tests { #[test] fn completes_bindings_from_if_let() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( r" fn quux() { @@ -215,7 +215,7 @@ mod tests { #[test] fn completes_bindings_from_for() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( r" fn quux() { @@ -247,7 +247,7 @@ mod tests { #[test] fn completes_generic_params() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( r" fn quux() { @@ -277,7 +277,7 @@ mod tests { #[test] fn completes_generic_params_in_struct() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( r" struct X { @@ -306,7 +306,7 @@ mod tests { #[test] fn completes_module_items() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( r" struct Foo; @@ -345,7 +345,7 @@ mod tests { #[test] fn completes_extern_prelude() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( r" //- /lib.rs @@ -369,7 +369,7 @@ mod tests { #[test] fn completes_module_items_in_nested_modules() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( r" struct Foo; @@ -401,7 +401,7 @@ mod tests { #[test] fn completes_return_type() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( r" struct Foo; @@ -430,7 +430,7 @@ mod tests { #[test] fn dont_show_both_completions_for_shadowing() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( r" fn foo() { @@ -465,7 +465,7 @@ mod tests { #[test] fn completes_self_in_methods() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion(r"impl S { fn foo(&self) { <|> } }"), @r#"[ CompletionItem { @@ -489,7 +489,7 @@ mod tests { #[test] fn completes_prelude() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( " //- /main.rs diff --git a/crates/ra_ide_api/src/completion/complete_snippet.rs b/crates/ra_ide_api/src/completion/complete_snippet.rs index a35f31511..b06221c2a 100644 --- a/crates/ra_ide_api/src/completion/complete_snippet.rs +++ b/crates/ra_ide_api/src/completion/complete_snippet.rs @@ -40,7 +40,7 @@ fn ${1:feature}() { #[cfg(test)] mod tests { use crate::completion::{do_completion, CompletionItem, CompletionKind}; - use insta::assert_debug_snapshot_matches; + use insta::assert_debug_snapshot; fn do_snippet_completion(code: &str) -> Vec { do_completion(code, CompletionKind::Snippet) @@ -48,7 +48,7 @@ mod tests { #[test] fn completes_snippets_in_expressions() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_snippet_completion(r"fn foo(x: i32) { <|> }"), @r#"[ CompletionItem { @@ -71,11 +71,11 @@ mod tests { #[test] fn should_not_complete_snippets_in_path() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_snippet_completion(r"fn foo(x: i32) { ::foo<|> }"), @r#"[]"# ); - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_snippet_completion(r"fn foo(x: i32) { ::<|> }"), @r#"[]"# ); @@ -83,7 +83,7 @@ mod tests { #[test] fn completes_snippets_in_items() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_snippet_completion( r" #[cfg(test)] diff --git a/crates/ra_ide_api/src/completion/presentation.rs b/crates/ra_ide_api/src/completion/presentation.rs index 147ceda0c..f19eec9b7 100644 --- a/crates/ra_ide_api/src/completion/presentation.rs +++ b/crates/ra_ide_api/src/completion/presentation.rs @@ -186,7 +186,7 @@ impl Completions { #[cfg(test)] mod tests { use crate::completion::{do_completion, CompletionItem, CompletionKind}; - use insta::assert_debug_snapshot_matches; + use insta::assert_debug_snapshot; use test_utils::covers; fn do_reference_completion(code: &str) -> Vec { @@ -196,7 +196,7 @@ mod tests { #[test] fn inserts_parens_for_function_calls() { covers!(inserts_parens_for_function_calls); - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( r" fn no_args() {} @@ -222,7 +222,7 @@ mod tests { }, ]"### ); - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( r" fn with_args(x: i32, y: String) {} @@ -248,7 +248,7 @@ mod tests { }, ]"### ); - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( r" struct S {} @@ -275,7 +275,7 @@ mod tests { #[test] fn dont_render_function_parens_in_use_item() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( " //- /lib.rs @@ -298,7 +298,7 @@ mod tests { #[test] fn dont_render_function_parens_if_already_call() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( " //- /lib.rs @@ -327,7 +327,7 @@ mod tests { }, ]"# ); - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( " //- /lib.rs -- cgit v1.2.3