From 186431e178c04fed8744d81b834547700af46430 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Fri, 6 Nov 2020 21:51:15 +0100 Subject: [PATCH] Adjust test-texts in infer_function_return_type --- .../handlers/infer_function_return_type.rs | 156 +++++++++--------- 1 file changed, 78 insertions(+), 78 deletions(-) diff --git a/crates/assists/src/handlers/infer_function_return_type.rs b/crates/assists/src/handlers/infer_function_return_type.rs index 80864c53072..520d07ae067 100644 --- a/crates/assists/src/handlers/infer_function_return_type.rs +++ b/crates/assists/src/handlers/infer_function_return_type.rs @@ -124,11 +124,11 @@ fn infer_return_type_specified_inferred() { check_assist( infer_function_return_type, r#"fn foo() -> <|>_ { - 45 - }"#, + 45 +}"#, r#"fn foo() -> i32 { - 45 - }"#, + 45 +}"#, ); } @@ -138,11 +138,11 @@ fn infer_return_type_specified_inferred_closure() { check_assist( infer_function_return_type, r#"fn foo() { - || -> _ {<|>45}; - }"#, + || -> _ {<|>45}; +}"#, r#"fn foo() { - || -> i32 {45}; - }"#, + || -> i32 {45}; +}"#, ); } @@ -152,11 +152,11 @@ fn infer_return_type_cursor_at_return_type_pos() { check_assist( infer_function_return_type, r#"fn foo() <|>{ - 45 - }"#, + 45 +}"#, r#"fn foo() -> i32 { - 45 - }"#, + 45 +}"#, ); } @@ -166,11 +166,11 @@ fn infer_return_type_cursor_at_return_type_pos_closure() { check_assist( infer_function_return_type, r#"fn foo() { - || <|>45 - }"#, + || <|>45 +}"#, r#"fn foo() { - || -> i32 {45} - }"#, + || -> i32 {45} +}"#, ); } @@ -180,11 +180,11 @@ fn infer_return_type() { check_assist( infer_function_return_type, r#"fn foo() { - 45<|> - }"#, + 45<|> +}"#, r#"fn foo() -> i32 { - 45 - }"#, + 45 +}"#, ); } @@ -193,19 +193,19 @@ fn infer_return_type_nested() { check_assist( infer_function_return_type, r#"fn foo() { - if true { - 3<|> - } else { - 5 - } - }"#, + if true { + 3<|> + } else { + 5 + } +}"#, r#"fn foo() -> i32 { - if true { - 3 - } else { - 5 - } - }"#, + if true { + 3 + } else { + 5 + } +}"#, ); } @@ -215,8 +215,8 @@ fn not_applicable_ret_type_specified() { check_assist_not_applicable( infer_function_return_type, r#"fn foo() -> i32 { - ( 45<|> + 32 ) * 123 - }"#, + ( 45<|> + 32 ) * 123 +}"#, ); } @@ -225,9 +225,9 @@ fn not_applicable_non_tail_expr() { check_assist_not_applicable( infer_function_return_type, r#"fn foo() { - let x = <|>3; - ( 45 + 32 ) * 123 - }"#, + let x = <|>3; + ( 45 + 32 ) * 123 +}"#, ); } @@ -236,8 +236,8 @@ fn not_applicable_unit_return_type() { check_assist_not_applicable( infer_function_return_type, r#"fn foo() { - (<|>) - }"#, + (<|>) +}"#, ); } @@ -247,15 +247,15 @@ fn infer_return_type_closure_block() { check_assist( infer_function_return_type, r#"fn foo() { - |x: i32| { - x<|> - }; - }"#, + |x: i32| { + x<|> + }; +}"#, r#"fn foo() { - |x: i32| -> i32 { - x - }; - }"#, + |x: i32| -> i32 { + x + }; +}"#, ); } @@ -264,11 +264,11 @@ fn infer_return_type_closure() { check_assist( infer_function_return_type, r#"fn foo() { - |x: i32| { x<|> }; - }"#, + |x: i32| { x<|> }; +}"#, r#"fn foo() { - |x: i32| -> i32 { x }; - }"#, + |x: i32| -> i32 { x }; +}"#, ); } @@ -278,11 +278,11 @@ fn infer_return_type_closure_wrap() { check_assist( infer_function_return_type, r#"fn foo() { - |x: i32| x<|>; - }"#, + |x: i32| x<|>; +}"#, r#"fn foo() { - |x: i32| -> i32 {x}; - }"#, + |x: i32| -> i32 {x}; +}"#, ); } @@ -291,23 +291,23 @@ fn infer_return_type_nested_closure() { check_assist( infer_function_return_type, r#"fn foo() { - || { - if true { - 3<|> - } else { - 5 - } - } - }"#, + || { + if true { + 3<|> + } else { + 5 + } + } +}"#, r#"fn foo() { - || -> i32 { - if true { - 3 - } else { - 5 - } - } - }"#, + || -> i32 { + if true { + 3 + } else { + 5 + } + } +}"#, ); } @@ -317,8 +317,8 @@ fn not_applicable_ret_type_specified_closure() { check_assist_not_applicable( infer_function_return_type, r#"fn foo() { - || -> i32 { 3<|> } - }"#, + || -> i32 { 3<|> } +}"#, ); } @@ -327,11 +327,11 @@ fn not_applicable_non_tail_expr_closure() { check_assist_not_applicable( infer_function_return_type, r#"fn foo() { - || -> i32 { - let x = 3<|>; - 6 - } - }"#, + || -> i32 { + let x = 3<|>; + 6 + } +}"#, ); } }