about summary refs log tree commit diff
path: root/library/core
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-07-26 00:57:21 +0200
committerGitHub <noreply@github.com>2024-07-26 00:57:21 +0200
commitab2dd3aeb95c3ef5d7a34b2435f1f95472dabc08 (patch)
treee53daac7f2d036b7c17adeeb5e0db2aba5407204 /library/core
parent29314e4fca75b09404a2dfb3686179d0bdb78bce (diff)
parentc5dadd0408bc5654f001efe0f2224ff67e5e90a7 (diff)
downloadrust-ab2dd3aeb95c3ef5d7a34b2435f1f95472dabc08.tar.gz
rust-ab2dd3aeb95c3ef5d7a34b2435f1f95472dabc08.zip
Rollup merge of #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 #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.

r? `@cuviper`
Diffstat (limited to 'library/core')
-rw-r--r--library/core/src/char/mod.rs5
-rw-r--r--library/core/src/unicode/mod.rs10
2 files changed, 11 insertions, 4 deletions
diff --git a/library/core/src/char/mod.rs b/library/core/src/char/mod.rs
index 3c641a2e01c..37c27ecb8c4 100644
--- a/library/core/src/char/mod.rs
+++ b/library/core/src/char/mod.rs
@@ -24,6 +24,8 @@ mod convert;
 mod decode;
 mod methods;
 
+// stable re-exports
+#[rustfmt::skip]
 #[stable(feature = "try_from", since = "1.34.0")]
 pub use self::convert::CharTryFromError;
 #[stable(feature = "char_from_str", since = "1.20.0")]
@@ -31,11 +33,14 @@ pub use self::convert::ParseCharError;
 #[stable(feature = "decode_utf16", since = "1.9.0")]
 pub use self::decode::{DecodeUtf16, DecodeUtf16Error};
 
+// perma-unstable re-exports
+#[rustfmt::skip]
 #[unstable(feature = "char_internals", reason = "exposed only for libstd", issue = "none")]
 pub use self::methods::encode_utf16_raw; // perma-unstable
 #[unstable(feature = "char_internals", reason = "exposed only for libstd", issue = "none")]
 pub use self::methods::encode_utf8_raw; // perma-unstable
 
+#[rustfmt::skip]
 use crate::ascii;
 use crate::error::Error;
 use crate::escape;
diff --git a/library/core/src/unicode/mod.rs b/library/core/src/unicode/mod.rs
index 5ddd9f7476d..6066aa99216 100644
--- a/library/core/src/unicode/mod.rs
+++ b/library/core/src/unicode/mod.rs
@@ -1,13 +1,15 @@
 #![unstable(feature = "unicode_internals", issue = "none")]
 #![allow(missing_docs)]
 
-// The `pub use` ones are for use in alloc, and are not re-exported in std.
-
-pub(crate) use unicode_data::alphabetic::lookup as Alphabetic;
+// for use in alloc, not re-exported in std.
+#[rustfmt::skip]
 pub use unicode_data::case_ignorable::lookup as Case_Ignorable;
 pub use unicode_data::cased::lookup as Cased;
-pub(crate) use unicode_data::cc::lookup as Cc;
 pub use unicode_data::conversions;
+
+#[rustfmt::skip]
+pub(crate) use unicode_data::alphabetic::lookup as Alphabetic;
+pub(crate) use unicode_data::cc::lookup as Cc;
 pub(crate) use unicode_data::grapheme_extend::lookup as Grapheme_Extend;
 pub(crate) use unicode_data::lowercase::lookup as Lowercase;
 pub(crate) use unicode_data::n::lookup as N;