1
Fork 0

Use #[rustfmt::skip] on some use groups to prevent reordering.

`use` declarations will be reformatted in #125443. Very rarely, there is
a desire to force a group of `use` declarations together in a way that
auto-formatting will break up. E.g. when you want a single comment to
apply to a group. #126776 dealt with all of these in the codebase,
ensuring that no comments intended for multiple `use` declarations would
end up in the wrong place. But some people were unhappy with it.

This commit uses `#[rustfmt::skip]` to create these custom `use` groups
in an idiomatic way for a few of the cases changed in #126776. This
works because rustfmt treats any `use` item annotated with
`#[rustfmt::skip]` as a barrier and won't reorder other `use` items
around it.
This commit is contained in:
Nicholas Nethercote 2024-07-19 11:02:59 +10:00
parent 5affbb1715
commit c5dadd0408
5 changed files with 16 additions and 4 deletions

View file

@ -16,9 +16,11 @@
#![deny(unsafe_op_in_unsafe_fn)]
#![allow(unused_macros)]
#[rustfmt::skip]
pub use crate::panicking::{begin_panic, panic_count};
pub use core::panicking::{panic_display, panic_fmt};
#[rustfmt::skip]
use crate::sync::Once;
use crate::sys;
use crate::thread::{self, Thread};