Skip to content

Commit 30cfde4

Browse files
authored
Rollup merge of rust-lang#127950 - nnethercote:rustfmt-skip-on-use-decls, r=cuviper
Use `#[rustfmt::skip]` on some `use` groups to prevent reordering. `use` declarations will be reformatted in rust-lang#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. rust-lang#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 rust-lang#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. r? `@cuviper`
2 parents ef4d4a0 + edc4cdc commit 30cfde4

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

core/src/char/mod.rs

+5
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,23 @@ mod convert;
2424
mod decode;
2525
mod methods;
2626

27+
// stable re-exports
28+
#[rustfmt::skip]
2729
#[stable(feature = "try_from", since = "1.34.0")]
2830
pub use self::convert::CharTryFromError;
2931
#[stable(feature = "char_from_str", since = "1.20.0")]
3032
pub use self::convert::ParseCharError;
3133
#[stable(feature = "decode_utf16", since = "1.9.0")]
3234
pub use self::decode::{DecodeUtf16, DecodeUtf16Error};
3335

36+
// perma-unstable re-exports
37+
#[rustfmt::skip]
3438
#[unstable(feature = "char_internals", reason = "exposed only for libstd", issue = "none")]
3539
pub use self::methods::encode_utf16_raw; // perma-unstable
3640
#[unstable(feature = "char_internals", reason = "exposed only for libstd", issue = "none")]
3741
pub use self::methods::encode_utf8_raw; // perma-unstable
3842

43+
#[rustfmt::skip]
3944
use crate::ascii;
4045
use crate::error::Error;
4146
use crate::escape;

core/src/unicode/mod.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
#![unstable(feature = "unicode_internals", issue = "none")]
22
#![allow(missing_docs)]
33

4-
// The `pub use` ones are for use in alloc, and are not re-exported in std.
5-
6-
pub(crate) use unicode_data::alphabetic::lookup as Alphabetic;
4+
// for use in alloc, not re-exported in std.
5+
#[rustfmt::skip]
76
pub use unicode_data::case_ignorable::lookup as Case_Ignorable;
87
pub use unicode_data::cased::lookup as Cased;
9-
pub(crate) use unicode_data::cc::lookup as Cc;
108
pub use unicode_data::conversions;
9+
10+
#[rustfmt::skip]
11+
pub(crate) use unicode_data::alphabetic::lookup as Alphabetic;
12+
pub(crate) use unicode_data::cc::lookup as Cc;
1113
pub(crate) use unicode_data::grapheme_extend::lookup as Grapheme_Extend;
1214
pub(crate) use unicode_data::lowercase::lookup as Lowercase;
1315
pub(crate) use unicode_data::n::lookup as N;

std/src/rt.rs

+2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@
1616
#![deny(unsafe_op_in_unsafe_fn)]
1717
#![allow(unused_macros)]
1818

19+
#[rustfmt::skip]
1920
pub use crate::panicking::{begin_panic, panic_count};
2021
pub use core::panicking::{panic_display, panic_fmt};
2122

23+
#[rustfmt::skip]
2224
use crate::sync::Once;
2325
use crate::sys;
2426
use crate::thread::{self, Thread};

0 commit comments

Comments
 (0)