-
Notifications
You must be signed in to change notification settings - Fork 922
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
Incorrect formatting of deeply nested block #4523
Comments
Note: for some reason it looks like this in my original code: match self.advance() {
Some('\'') => self.make_token(TokenType::Char),
Some(_) => {
loop {
match self.advance() {
Some('\'') => break self.error_token("character literals must contain exactly one Unicode character".to_owned()),
None => break self.error_token("unterminated character literal".to_owned())
}
}
}
None => self.error_token("unterminated character literal".to_owned()),
} Not sure why that's not happening in the MCVE 🤷 |
Closing as duplicate of #3863 The problem is the string arg to Tactical approaches you can consider leveraging to address this are to turn on |
Yeah, I ended up fixing it by moving it into a function, which makes the code easier to understand anyway. It was just frustrating that rustfmt would format it poorly and there was no way to stop it. |
Could you elaborate on this a bit? With the chain/max_width issue, rustfmt isn't doing any formatting, but is simply leaving your original formatting in place. This would have then required manual formatting, but rustfmt shouldn't have been fighting your manual formatting (providing the same line length issue still existed) |
Hmm, it looks like it is letting me do it after all. Not sure why I thought it wasn't. Sorry about that! |
Describe the bug
The inner
loop
and thematch
within are indented incorrectly.To Reproduce
*Note: I know this code looks really bogus, but it's actually extracted from something I'm working on. I added the many layers of modules so that I could reproduce this without sharing all the code.
Playground
Expected behavior
I guess rustfmt is having trouble because it can't make the lines fit within 100 characters, but I would rather it indent it like this:
Meta
The text was updated successfully, but these errors were encountered: