about summary refs log tree commit diff
path: root/library/std/src/prelude
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-06-20 15:44:13 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2024-07-17 08:02:46 +1000
commit75b6ec980059292faa9cdf538b552faf6b70fb29 (patch)
tree6c240deb73e49cdf8bf1558673b1e875d22845e1 /library/std/src/prelude
parentd9fde2504a1e77765e9505d2346a15867ad5a4b8 (diff)
Avoid comments that describe multiple `use` items.
There are some comments describing multiple subsequent `use` items. When
the big `use` reformatting happens some of these `use` items will be
reordered, possibly moving them away from the comment. With this
additional level of formatting it's not really feasible to have comments
of this type. This commit removes them in various ways:

- merging separate `use` items when appropriate;

- inserting blank lines between the comment and the first `use` item;

- outright deletion (for comments that are relatively low-value);

- adding a separate "top-level" comment.

We also entirely skip formatting for four library files that contain
nothing but `pub use` re-exports, where reordering would be painful.
Diffstat (limited to 'library/std/src/prelude')
-rw-r--r--library/std/src/prelude/common.rs3
-rw-r--r--library/std/src/prelude/mod.rs3
2 files changed, 6 insertions, 0 deletions
diff --git a/library/std/src/prelude/common.rs b/library/std/src/prelude/common.rs
index 055ab7eb6d9..b231bd871b3 100644
--- a/library/std/src/prelude/common.rs
+++ b/library/std/src/prelude/common.rs
@@ -2,6 +2,9 @@
 //!
 //! See the [module-level documentation](super) for more.
 
+// No formatting: this file is nothing but re-exports, and their order is worth preserving.
+#![cfg_attr(rustfmt, rustfmt::skip)]
+
 // Re-exported core operators
 #[stable(feature = "rust1", since = "1.0.0")]
 #[doc(no_inline)]
diff --git a/library/std/src/prelude/mod.rs b/library/std/src/prelude/mod.rs
index 2d4639342bf..0c610ba67e6 100644
--- a/library/std/src/prelude/mod.rs
+++ b/library/std/src/prelude/mod.rs
@@ -95,6 +95,9 @@
 //! [book-enums]: ../../book/ch06-01-defining-an-enum.html
 //! [book-iter]: ../../book/ch13-02-iterators.html
 
+// No formatting: this file is nothing but re-exports, and their order is worth preserving.
+#![cfg_attr(rustfmt, rustfmt::skip)]
+
 #![stable(feature = "rust1", since = "1.0.0")]
 
 mod common;