Fix match enum OR comment indentation
Fixes https://github.com/rust-lang/rustfmt/issues/6060
This was a bit tricky.
When the inner item is multiline, identation-count before the actual inner item start throws off the line count.
In the usual case, the inner item doesn't contain indentation, example:
fn simple(
// pre-comment on a function!?
i: i32, // yes, it's possible!
response: NoWay, // hose
)
in the above case, the inner item is i: i32, no comma, no indentation.
So when calculating whether the inner item is too long to add more spaces already, indentation needs to be removed beforehand, but only for inner items that have newlines in them. In the below case, the inner item is the entire:
msgs::DecodeError::UnknownRequiredFeature
| msgs::DecodeError::InvalidValue
| msgs::DecodeError::ShortRead => 0x4000 | 22
Newlines and indentation all.
If the line does become too long by the comment, it will be split and use the old logic in a branch, I added a test for that as well.
Rebased to master since this had become a bit stale
On hold, ran some diffs and it looks like here may be some problems with this one