Skip to content

Strange formatting when comments are interspersed in an expression. #6269

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

Closed
JulianKnodt opened this issue Aug 5, 2024 · 1 comment
Closed

Comments

@JulianKnodt
Copy link
Contributor

JulianKnodt commented Aug 5, 2024

Minimal(ish) repo:

fn main() {
    let v = 1 + 1 +
  // test
  3;
  
    let test = 3;
    // o
}

I would expect the comment // test to have the correct indentation and 3 to also be indented.
The later lines are indented correctly.

Tested on current playground, Rust 1.70 Stable
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=b7abe453f272fbf2bd4e8dfeac344ddb

@ytmimi
Copy link
Contributor

ytmimi commented Aug 6, 2024

I believe this is the same underlying issue as #3591 and #3167. rustfmt doesn't handle comments well within binary operators.

@ytmimi ytmimi closed this as not planned Won't fix, can't repro, duplicate, stale Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants