Skip to content

Commit 5540f94

Browse files
committed
Add tests for issue 4573
It's unclear which PR resolved this issue, however the behavior of adding inline comments to the next line can't be reproduced. These test cases should serve to prevent a regression.
1 parent a37d3ab commit 5540f94

File tree

1 file changed

+97
-0
lines changed

1 file changed

+97
-0
lines changed

tests/target/issue_4573.rs

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
// rustmft-version:Two
2+
// rustmft-use_small_heuristics:Max
3+
// rustmft-merge_derives:false
4+
// These are the same rustfmt configuration options that are used
5+
// in the comiler as of ce39461ca75a and 8eb7c58dbb7b
6+
// These are commits in https://github.com/rust-lang/rust
7+
8+
#[cfg(not(miri))] // inline comment
9+
extern crate foo;
10+
11+
#[cfg(not(miri))] // inline comment
12+
extern crate foo as bar;
13+
14+
#[cfg(not(miri))] // inline comment
15+
use foo;
16+
17+
#[cfg(not(miri))] // inline comment
18+
use foo;
19+
20+
#[cfg(not(miri))] // inline comment
21+
use foo::bar;
22+
23+
#[cfg(not(miri))] // inline comment
24+
use foo::bar as FooBar;
25+
26+
#[cfg(not(miri))] // inline comment
27+
static FOO: i32 = 42;
28+
29+
#[cfg(not(miri))] // inline comment
30+
static FOO: i32 = 42;
31+
32+
#[cfg(not(miri))] // inline comment
33+
static FOO: &'static str = "bar";
34+
35+
#[cfg(not(miri))] // inline comment
36+
const FOO: i32 = 42;
37+
38+
#[cfg(not(miri))] // inline comment
39+
fn foo(bar: usize) {
40+
#[cfg(not(miri))] // inline comment
41+
println!("hello world!");
42+
}
43+
44+
#[cfg(not(miri))] // inline comment
45+
mod foo {}
46+
47+
#[cfg(not(miri))] // inline comment
48+
mod foo {}
49+
50+
#[cfg(not(miri))] // inline comment
51+
extern "C" {
52+
fn my_c_function(x: i32) -> bool;
53+
}
54+
55+
#[cfg(not(miri))] // inline comment
56+
extern "C" {
57+
fn my_c_function(x: i32) -> bool;
58+
}
59+
60+
#[cfg(not(miri))] // inline comment
61+
pub extern "C" fn callable_from_c(x: i32) -> bool {
62+
x % 3 == 0
63+
}
64+
65+
#[cfg(not(miri))] // inline comment
66+
type Foo = Bar<u8>;
67+
68+
#[cfg(not(miri))] // inline comment
69+
enum Foo {
70+
Bar,
71+
Baz,
72+
}
73+
74+
#[cfg(not(miri))] // inline comment
75+
struct Foo<A> {
76+
x: A,
77+
}
78+
79+
#[cfg(not(miri))] // inline comment
80+
union Foo<A, B> {
81+
x: A,
82+
y: B,
83+
}
84+
85+
#[cfg(not(miri))] // inline comment
86+
trait Foo {}
87+
88+
#[cfg(not(miri))] // inline comment
89+
trait Foo = Bar + Quux;
90+
91+
#[cfg(not(miri))] // inline comment
92+
impl Foo {}
93+
94+
#[cfg(not(miri))] // inline comment
95+
macro_rules! bar {
96+
(3) => {};
97+
}

0 commit comments

Comments
 (0)