1 // > Suggest `return`ing tail expressions that match return type
3 // > Some newcomers are confused by the behavior of tail expressions,
4 // > interpreting that "leaving out the `;` makes it the return value".
5 // > To help them go in the right direction, suggest using `return` instead
7 // (original commit description for this test)
9 // This test was amended to also serve as a regression test for #92308, where
10 // this suggestion would not trigger with async functions.
17 fn foo(x: bool) -> Result<f64, i32> {
19 Err(42) //~ ERROR mismatched types
20 //| HELP you might have meant to return this value
25 async fn bar(x: bool) -> Result<f64, i32> {
27 Err(42) //~ ERROR mismatched types
28 //| HELP you might have meant to return this value
37 impl<T> Identity for T {
41 async fn foo2() -> i32 {
43 1i32 //~ ERROR mismatched types
44 //| HELP you might have meant to return this value