Closed as not planned
Description
Here is a case where rustfmt, as part of reordering imports, literally moves a comment from one import to another, entirely destroying its meaning:
mod realstd {
struct __FastLocalKeyInner;
}
mod local {
mod fast {
struct Key;
}
}
#[cfg(test)] // comment associated with realstd import
pub use realstd::thread::__FastLocalKeyInner;
#[cfg(test)]
pub use self::local::fast::Key as __FastLocalKeyInnerUnused; // comment associated with fast import
fn main() {}
After formatting, the imports look like
#[cfg(test)]
pub use self::local::fast::Key as __FastLocalKeyInnerUnused;
#[cfg(test)] // comment associated with realstd import
pub use realstd::thread::__FastLocalKeyInner; // comment associated with fast import
Not that the comment that explained the use self::local::fast::Key as
, got moved to the other use
!
This is with rustfmt 1.5.1-nightly (2022-08-05 affe0d3).