Closed AeonSolstice closed 5 days ago
I think this is caused in the following part. https://github.com/rust-lang/rustfmt/blob/777e25a8c91af9923ad356eb4448ac2ed15167a9/src/chains.rs#L450 rustfmt intentionally trims the try operator and then removes the resulting blank line (the try operator is checked elsewhere and reattached later). However, it appears that it mistakenly removes the blank line even when there isn’t a try operator. —just my guess, though. https://github.com/rust-lang/rustfmt/blob/777e25a8c91af9923ad356eb4448ac2ed15167a9/src/chains.rs#L1015-L1038
Just now realizing that this is a duplicate of #4012
Using vscode I comment out the following to test something quickly, and save
Rustfmt produces the following output
I finish testing. The commented code is still highlighted and I need to Ctrl-Z 2 times and save again to get my original, clear, code.
I would expect 2+(incl.) newlines to get reduced to 1, but single ones should be kept. Commented section does not necessarily need to be code.