about summary refs log tree commit diff
path: root/tests/ui/async-await/missing-return-in-async-block.fixed
blob: 625079c3fbc290018ee0ce0efac918137282a6b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//@ run-rustfix
//@ edition:2021
use std::future::Future;
use std::pin::Pin;
pub struct S;
pub fn foo() {
    let _ = Box::pin(async move {
        if true {
            return Ok(S); //~ ERROR mismatched types
        }
        Err(())
    });
}
pub fn bar() -> Pin<Box<dyn Future<Output = Result<S, ()>> + 'static>> {
    Box::pin(async move {
        if true {
            return Ok(S); //~ ERROR mismatched types
        }
        Err(())
    })
}
fn main() {}