Skip to content

Commit e563f1b

Browse files
committed
Version gate matches! special case formatting
After special casing `matches!`, the formatting more closely resembles `match` expressions. These changes cause breaking formatting changes to that need to be version gated.
1 parent 9d6a512 commit e563f1b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/macros.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use rustc_span::{
2424
use crate::comment::{
2525
contains_comment, CharClasses, FindUncommented, FullCodeCharKind, LineClasses,
2626
};
27-
use crate::config::lists::*;
27+
use crate::config::{lists::*, Version};
2828
use crate::expr::{choose_separator_tactic, rewrite_array, rewrite_assign_rhs, RhsAssignKind};
2929
use crate::lists::{itemize_list, write_list, ListFormatting};
3030
use crate::matches::rewrite_guard;
@@ -232,7 +232,7 @@ fn rewrite_macro_inner(
232232
if let success @ Some(..) = format_lazy_static(context, shape, ts.clone()) {
233233
return success;
234234
}
235-
} else if macro_name == "matches!" {
235+
} else if macro_name == "matches!" && context.config.version() == Version::Two {
236236
if let success @ Some(..) = format_matches(context, shape, &macro_name, mac) {
237237
return success;
238238
}

0 commit comments

Comments
 (0)