Open
Description
mod modules {
#[rustfmt::skip]
#[path = "/dev/null"]
mod first;
/// ...
/// ...
#[rustfmt::skip]
#[path = "/dev/null"]
mod second;
}
Running rustfmt on this file turns it into:
mod modules {
#[rustfmt::skip]
#[path = "/dev/null"]
mod first; /// ...
/// ...
#[rustfmt::skip]
#[path = "/dev/null"]
mod second;
}
< mod first;
<
< /// ...
< /// ...
---
> mod first; /// ...
> /// ...
Observations:
- The
#[path = "/dev/null"]
attribute is not necessary for the repro. It is just to make this reproducible with a single input file. - Both
#[rustfmt::skip]
are necessary for the repro. Without either one, the problem does not occur. - Both
;
are necessary for the repro. If either module uses{
}
instead of;
, the problem does not occur. - The outer module is necessary.