Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code formatting is broken by let_chains in VSCode #14397

Closed
Drestin opened this issue Mar 24, 2023 · 2 comments
Closed

Code formatting is broken by let_chains in VSCode #14397

Drestin opened this issue Mar 24, 2023 · 2 comments
Labels
C-bug Category: bug

Comments

@Drestin
Copy link

Drestin commented Mar 24, 2023

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.

@Drestin Drestin added the C-bug Category: bug label Mar 24, 2023
@lnicola
Copy link
Member

lnicola commented Mar 24, 2023

We use rustfmt for formatting, which doesn't support that feature: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=b1cd259263bf700e27e185d471fc479c, rust-lang/rustfmt#5203.

@lnicola lnicola closed this as not planned Won't fix, can't repro, duplicate, stale Mar 24, 2023
@Drestin
Copy link
Author

Drestin commented Mar 24, 2023

Oh OK sorry, I didn't look into the right tool.
Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants