Replace match expression with match! macro
This is a follow up to
The matches! macro expresses the condition more succinctly and avoids
the extra level of indentation introduced with the match arm body.
@@ -367,11 +367,9 @@ where
result.push_str(&comment);
if !inner_item.is_empty() {
- match tactic {
- DefinitiveListTactic::SpecialMacro(_)
- | DefinitiveListTactic::Vertical
- | DefinitiveListTactic::Mixed => {
- // We cannot keep pre-comments on the same line if the comment is normalized
+ use DefinitiveListTactic::*;
+ if matches!(tactic, Vertical | Mixed | SpecialMacro(_)) {
+ // We cannot keep pre-comments on the same line if the comment is normalized.
let keep_comment = if formatting.config.normalize_comments()
|| item.pre_comment_style == ListItemCommentStyle::DifferentLine
{
@@ -390,8 +388,8 @@ where
// This is the width of the item (without comments).
line_len = item.item.as_ref().map_or(0, |s| unicode_str_width(&s));
}
- }
- _ => result.push(' '),
+ } else {
+ result.push(' ')
}
}
item_max_width = None;
