Adjust test-texts in infer_function_return_type

This commit is contained in:
Lukas Wirth 2020-11-06 21:51:15 +01:00
parent 4f0d02c276
commit 186431e178

View File

@ -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
}
}"#,
);
}
}