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
let error_code = match err {
msgs::DecodeError::UnknownVersion => 0x4000 | 1,// unknown realm byte
msgs::DecodeError::UnknownRequiredFeature|
msgs::DecodeError::InvalidValue|
msgs::DecodeError::ShortRead => 0x4000 | 22,// invalid_onion_payload
_ => 0x2000 | 2,// Should never happen};
we receive this result:
let error_code = match err {
msgs::DecodeError::UnknownVersion => 0x4000 | 1,// unknown realm byte
msgs::DecodeError::UnknownRequiredFeature
| msgs::DecodeError::InvalidValue
| msgs::DecodeError::ShortRead => 0x4000 | 22,// invalid_onion_payload
_ => 0x2000 | 2,// Should never happen};
Note that the comment at the end of the second match arm is unaligned with the others. For the third match arm rustfmt even introduces many whitespaces to ensure it's aligned with the in the first match arm. However, it seems that rustfmt entirely forgets about this alignment in the second match arm, presumably due to it being an OR pattern
This seems to happen independently from any particular config option or rustfmt version, but currently I'm using
Thanks for the report. Yeah, there's something about the OR pattern that's throwing off the alignment. Without the OR pattern things align as you'd expect.
Input:
fnmain(){let error_code = match err {
msgs::DecodeError::UnknownVersion => 0x4000 | 1,// unknown realm byte
msgs::DecodeError::ShortRead => 0x4000 | 22,// invalid_onion_payload
_ => 0x2000 | 2,// Should never happen};}
Output:
fnmain(){let error_code = match err {
msgs::DecodeError::UnknownVersion => 0x4000 | 1,// unknown realm byte
msgs::DecodeError::ShortRead => 0x4000 | 22,// invalid_onion_payload
_ => 0x2000 | 2,// Should never happen};}
When reformatting the following example:
we receive this result:
Note that the comment at the end of the second match arm is unaligned with the others. For the third match arm
rustfmt
even introduces many whitespaces to ensure it's aligned with the in the first match arm. However, it seems thatrustfmt
entirely forgets about this alignment in the second match arm, presumably due to it being an OR patternThis seems to happen independently from any particular config option or
rustfmt
version, but currently I'm usingThe text was updated successfully, but these errors were encountered: