You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// The indentation stays the same, as expectedfnfoobar(){let x = y else{panic!();};}// The indentation is increased every time you run `cargo fmt`macro_rules! foobar {() => {let pat = expr else {
panic!();};};}
Thanks for reaching out. I think the underlying issue is that rustfmt doesn't currently format let else expressions because the rules for formatting them have not yet been finalized via an RFC in fmt-rfcs repo.
Related issues are #5489, #5044, and #4609 which also deal with cases where extra indentation is added in macro definitions when rustfmt fails to format the macro body.
It's quite interesting that this is the second time that this specific let else case was hit. Maybe many people wrote macros in that fashion and now want to replace them with let else?
As mentioned above, the underlying issue here is that rustfmt doesn't currently format let else. Rules need to be added to the Rust Style Guide before an implementation can be added to rustfmt. If you want to stay informed about the style discussion you can subscribe to rust-lang/style-team#165, and to keep up with implementation progress you can subscribe to #4914.
If the macro indentation behavior continues after let else formatting is implemented, then we can reopen this issue and investigate further.
Activity
ytmimi commentedon Aug 15, 2022
Thanks for reaching out. I think the underlying issue is that rustfmt doesn't currently format let else expressions because the rules for formatting them have not yet been finalized via an RFC in fmt-rfcs repo.
Related issues are #5489, #5044, and #4609 which also deal with cases where extra indentation is added in macro definitions when rustfmt fails to format the macro body.
est31 commentedon Sep 23, 2022
This is a precise dupe of #5213 , which got closed as dupe of the issues linked above.
est31 commentedon Sep 23, 2022
It's quite interesting that this is the second time that this specific let else case was hit. Maybe many people wrote macros in that fashion and now want to replace them with
let else
?PoignardAzur commentedon Sep 23, 2022
I don't know about the other bug, but I was writing
assert_let
.ytmimi commentedon Sep 26, 2022
Going to close this as a duplicate of #5213
As mentioned above, the underlying issue here is that rustfmt doesn't currently format
let else
. Rules need to be added to the Rust Style Guide before an implementation can be added to rustfmt. If you want to stay informed about the style discussion you can subscribe to rust-lang/style-team#165, and to keep up with implementation progress you can subscribe to #4914.If the macro indentation behavior continues after
let else
formatting is implemented, then we can reopen this issue and investigate further.let ... = ... else {}
badly and infinitely indented with repeated formatting #5866