Closed
Description
When using a leading |
in the matches!
macro, this leads to some weird formatting looking like closure syntax:
enum Bla {
A,
B,
}
impl Bla {
// before processing by `rustfmt`
pub fn weird_unformatted(self) -> bool {
matches!(self, | Self::A | Self::B)
}
// output of `rustfmt` --- looks like closure syntax!
pub fn weird_formatted(self) -> bool {
matches!(self, |Self::A| Self::B)
}
// what if we use just plain `match`?
pub fn match_unformatted(self) -> bool {
match self {
| Self::A | Self::B => true,
}
}
// that looks better!
pub fn match_formatted(self) -> bool {
match self {
Self::A | Self::B => true,
}
}
}