Skip to content

Commit

Permalink
Version gate matches! special case formatting
Browse files Browse the repository at this point in the history
After special casing `matches!`, the formatting more closely resembles
`match` expressions. These changes cause breaking formatting changes to
that need to be version gated.
  • Loading branch information
ytmimi committed Oct 1, 2022
1 parent 8b1df6f commit f8ce44f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use rustc_span::{
use crate::comment::{
contains_comment, CharClasses, FindUncommented, FullCodeCharKind, LineClasses,
};
use crate::config::lists::*;
use crate::config::{lists::*, Version};
use crate::expr::{choose_separator_tactic, rewrite_array, rewrite_assign_rhs, RhsAssignKind};
use crate::lists::{itemize_list, write_list, ListFormatting};
use crate::matches::rewrite_guard;
Expand Down Expand Up @@ -232,7 +232,7 @@ fn rewrite_macro_inner(
if let success @ Some(..) = format_lazy_static(context, shape, ts.clone()) {
return success;
}
} else if macro_name == "matches!" {
} else if macro_name == "matches!" && context.config.version() == Version::Two {
if let success @ Some(..) = format_matches(context, shape, &macro_name, &mac.args) {
return success;
}
Expand Down

0 comments on commit f8ce44f

Please sign in to comment.