rustfmt icon indicating copy to clipboard operation
rustfmt copied to clipboard

Wrong indentation when using double `?` to handle long async function calls

Open eareimu opened this issue 6 months ago • 2 comments

I really don't know how to describe this ... How i found it ??? This is the simplest case I've tried to summarize.

For the code:

mod any {
    async fn f2345678901234567890123456789012345678901() -> Option<Option<((), ())>> {
        None
    }

    async fn foo() -> Option<()> {
        let a23456789012345678901234567890 = f2345678901234567890123456789012345678901()
            .await
            .inspect(|_| {
            println!();
            println!();
        })??;

        Some(())
    }
}

eareimu avatar May 13 '25 07:05 eareimu

@eareimu just to confirm, the issue here is that the closure in the .inspect call isn't indented correctly, right?

ytmimi avatar May 31 '25 15:05 ytmimi

@eareimu just to confirm, the issue here is that the closure in the .inspect call isn't indented correctly, right?@eareimu 想确认一下,这里的问题是不是 .inspect 调用中的闭包缩进不正确?

Yes.

eareimu avatar Jun 01 '25 15:06 eareimu