Skip to content

Commit 7b12588

Browse files
committed
Add test case for issue 6714
1 parent 1a502d0 commit 7b12588

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

tests/source/issue_6714.rs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// rustfmt-style_edition: 2027
2+
3+
// The only difference between the two macros here is that one uses
4+
// `matches!('a', 'a'..='z' | '0'..='9')` while the other use
5+
// `matches!('a', 'a'..='z' | '0')`, without the second range. The problem is
6+
// that the first isn't formated by rustfmt.
7+
// You can test it yourself by using the Rustfmt tool, top right
8+
//
9+
// (Note that in this specific example, I could have used
10+
// `matches!('a', 'a'..='z') || matches!('a', '0'..='9')`, which *is* formated,
11+
// but that's not the point)
12+
13+
macro_rules! this_macro_will_not_be_formated {
14+
() => {
15+
16+
let _ =
17+
"some ugly not formated code"
18+
;
19+
20+
let _ = matches!('a', 'a'..='z' | '0'..='9');
21+
22+
};
23+
}
24+
25+
macro_rules! this_macro_will_be_formated {
26+
() => {
27+
28+
let _ =
29+
"some ugly not formated code"
30+
;
31+
32+
let _ = matches!('a', 'a'..='z' | '0');
33+
34+
};
35+
}
36+

tests/target/issue_6714.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// rustfmt-style_edition: 2027
2+
3+
// The only difference between the two macros here is that one uses
4+
// `matches!('a', 'a'..='z' | '0'..='9')` while the other use
5+
// `matches!('a', 'a'..='z' | '0')`, without the second range. The problem is
6+
// that the first isn't formated by rustfmt.
7+
// You can test it yourself by using the Rustfmt tool, top right
8+
//
9+
// (Note that in this specific example, I could have used
10+
// `matches!('a', 'a'..='z') || matches!('a', '0'..='9')`, which *is* formated,
11+
// but that's not the point)
12+
13+
macro_rules! this_macro_will_not_be_formated {
14+
() => {
15+
let _ = "some ugly not formated code";
16+
17+
let _ = matches!('a', 'a'..='z' | '0'..='9');
18+
};
19+
}
20+
21+
macro_rules! this_macro_will_be_formated {
22+
() => {
23+
let _ = "some ugly not formated code";
24+
25+
let _ = matches!('a', 'a'..='z' | '0');
26+
};
27+
}

0 commit comments

Comments
 (0)