-
Notifications
You must be signed in to change notification settings - Fork 925
rustfmt barely does any formatting anymore #4460
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
Comments
Do you have any non-default configuration values, particularly related to |
@calebcartwright Nope, I've changed nothing. I verified that I get the same output from running the rustfmt executable directly (in case rust-analyzer was influencing things) and it's exactly the same. |
I ran |
The snippet you've provided isn't reproducible on the playground (I know that's v1.4.22 but I don't anticipate that making a difference) Can you provide a complete snippet that reproduces the issue? |
I suspect the odds are pretty high that you are running into the existing issue with chains, though there'd have to be more to your snippet to hit that which is why a complete and reproducible snippet will be beneficial so we can rule out any unknown/separate issues. |
Perfect, thanks @drguildo it is indeed the existing chain issue, in your case caused by the length of the In the short term, if you're able/willing to use nightly then you can keep the code as-is and should be able to set If you can't use nightly, then you could alternatively consider creating a local variable (e.g. .subcommand(
SubCommand::with_name("read-tree").about(read_tree_about).arg(Arg::with_name("tree_oid").required(true)),
) And then at some point down the road we'll most likely have some improvements within rustfmt to deal with this sort of max_width-exceeding scenario. I'm going to close this as a duplicate, feel free to subscribe to the #3863 to track updates on said future enhancements |
Thanks for the useful advice and help in identifying the cause. |
Apologies if this is how rustfmt has always been, I don't normally use it directly but rather use rust-analyzer which I think uses rustfmt but may have switched to rustfmt from something else recently.
Anyway... rustfmt used to do a very good and comprehensive job of formatting my code, but since (I assume) the last update the quality of formatting has decreased massively. I can have extremely long lines with spurious, inconsistent whitespace and rustfmt will happily ignore it.
I've done my best at remembering and reproducing the kind of formatting that used to take place.
Input
Output
Expected output
Meta
The text was updated successfully, but these errors were encountered: