rust-lang / rustfmt

Format Rust code
https://rust-lang.github.io/rustfmt/
Apache License 2.0
6.05k stars 888 forks source link

Not formatting. #6352

Closed coolcatcoder closed 1 month ago

coolcatcoder commented 1 month ago

I think I broke rustfmt as in my project it doesn't format:

let wow =          0.0;

In the playground, it removes all the whitespace. What I've tried:

What further troubleshooting steps can I try? (My project is using nightly, in case that is of relevance.)

coolcatcoder commented 1 month ago

Huh, it somehow fixed itself, while I carred on coding, something made it start working again, I don't know what. I committed when the fmt was broken though, luckily. (I can try figure out a min code replication of the issue if you want me to?)

ytmimi commented 1 month ago

@coolcatcoder thanks for the report. it would be helpful to know what version of rustfmt you're using.

Also, without a code snippet that reproduces the problem there's very little anyone can do to help.

coolcatcoder commented 1 month ago

(Sorry for the late reply!) I was using rustfmt 1.8.0-nightly (fa724e5d8c 2024-09-27). I've attempted and failed to come up with a way to reproduce the problem. I can give you the 800 line file if you want? (The 800 line file does fail to fmt in the playground, so it is consistent!) I'll leave it here, incase you want it.

ytmimi commented 1 month ago

Thanks for the link, though 800 lines is a lot to go through. We can reopen this if you're able to get this down to a smaller reproducible example. rustfmt works on code that doesn't compile as long as it parses, so if you don't need certain struct, enum, trait, or function definitions to reproduce the issue you can consider removing them to narrow this down.