Skip to content

Code formatting is broken by let_chains in VSCode #14397

Closed as not planned
Closed as not planned
@Drestin

Description

@Drestin

When using the nightly feature let_chains, any file that contains a let chain can no longer be formatted.

Minimal example:

#![feature(let_chains)]

fn main() {
    let a = Some(true);
    if let Some(b) = a && b
    {
        println!("Hello, world!");
    }
}
  • The syntax highlighting or the quick fixes still work.
  • If I comment && b, the formatting works.
  • Also happens with while let &&

I am using:

  • latest version of the rust-analyzer extension (0.3.1443).
  • Linux (Manjaro)
  • Rust nightly-2023-03-18
  • VSCodium 1.75.1

I couldn't find an existing issue on this, which strikes me as strange since it is a very easy to run into it, for a somewhat popular nightly feature. Sorry if this is a duplicate.

Also, I filed it as a bug (since it breaks the formatting of the whole file), but it could very well be a missing feature depending how you look at it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions