about summary refs log tree commit diff
path: root/library/alloc
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-09-22 19:05:04 -0400
committerMichael Goulet <michael@errs.io>2024-09-22 19:11:29 -0400
commitc682aa162b0d41e21cc6748f4fecfe01efb69d1f (patch)
tree0c31b640e3faacfb187a1509e3da5d5b6ba0109c /library/alloc
parent1173204b364841b51598744fc69d7c80be10f956 (diff)
Reformat using the new identifier sorting from rustfmt
Diffstat (limited to 'library/alloc')
-rw-r--r--library/alloc/benches/binary_heap.rs2
-rw-r--r--library/alloc/benches/btree/map.rs4
-rw-r--r--library/alloc/benches/slice.rs4
-rw-r--r--library/alloc/benches/str.rs2
-rw-r--r--library/alloc/benches/string.rs2
-rw-r--r--library/alloc/benches/vec.rs2
-rw-r--r--library/alloc/benches/vec_deque.rs4
-rw-r--r--library/alloc/src/boxed.rs7
-rw-r--r--library/alloc/src/collections/binary_heap/mod.rs2
-rw-r--r--library/alloc/src/collections/binary_heap/tests.rs2
-rw-r--r--library/alloc/src/collections/btree/fix.rs2
-rw-r--r--library/alloc/src/collections/btree/map.rs4
-rw-r--r--library/alloc/src/collections/btree/map/entry.rs2
-rw-r--r--library/alloc/src/collections/btree/map/tests.rs2
-rw-r--r--library/alloc/src/collections/btree/navigate.rs2
-rw-r--r--library/alloc/src/collections/btree/remove.rs2
-rw-r--r--library/alloc/src/collections/btree/search.rs2
-rw-r--r--library/alloc/src/collections/btree/set.rs2
-rw-r--r--library/alloc/src/collections/btree/set/tests.rs18
-rw-r--r--library/alloc/src/collections/linked_list/tests.rs30
-rw-r--r--library/alloc/src/collections/vec_deque/mod.rs2
-rw-r--r--library/alloc/src/collections/vec_deque/tests.rs7
-rw-r--r--library/alloc/src/ffi/c_str.rs2
-rw-r--r--library/alloc/src/fmt.rs6
-rw-r--r--library/alloc/src/rc.rs4
-rw-r--r--library/alloc/src/slice.rs16
-rw-r--r--library/alloc/src/str.rs14
-rw-r--r--library/alloc/src/string.rs6
-rw-r--r--library/alloc/src/sync.rs2
-rw-r--r--library/alloc/src/sync/tests.rs2
-rw-r--r--library/alloc/src/vec/in_place_collect.rs2
-rw-r--r--library/alloc/src/vec/in_place_drop.rs2
-rw-r--r--library/alloc/tests/slice.rs2
-rw-r--r--library/alloc/tests/str.rs165
-rw-r--r--library/alloc/tests/string.rs35
-rw-r--r--library/alloc/tests/vec.rs2
-rw-r--r--library/alloc/tests/vec_deque.rs4
-rw-r--r--library/alloc/tests/vec_deque_alloc_error.rs4
38 files changed, 174 insertions, 200 deletions
diff --git a/library/alloc/benches/binary_heap.rs b/library/alloc/benches/binary_heap.rs
index 917e71f250e..1b8f7f1c242 100644
--- a/library/alloc/benches/binary_heap.rs
+++ b/library/alloc/benches/binary_heap.rs
@@ -1,7 +1,7 @@
 use std::collections::BinaryHeap;
 
 use rand::seq::SliceRandom;
-use test::{black_box, Bencher};
+use test::{Bencher, black_box};
 
 #[bench]
 fn bench_find_smallest_1000(b: &mut Bencher) {
diff --git a/library/alloc/benches/btree/map.rs b/library/alloc/benches/btree/map.rs
index 3bddef5045a..b8119c9f0eb 100644
--- a/library/alloc/benches/btree/map.rs
+++ b/library/alloc/benches/btree/map.rs
@@ -1,9 +1,9 @@
 use std::collections::BTreeMap;
 use std::ops::RangeBounds;
 
-use rand::seq::SliceRandom;
 use rand::Rng;
-use test::{black_box, Bencher};
+use rand::seq::SliceRandom;
+use test::{Bencher, black_box};
 
 macro_rules! map_insert_rand_bench {
     ($name: ident, $n: expr, $map: ident) => {
diff --git a/library/alloc/benches/slice.rs b/library/alloc/benches/slice.rs
index ab46603d773..48c74c4491d 100644
--- a/library/alloc/benches/slice.rs
+++ b/library/alloc/benches/slice.rs
@@ -1,8 +1,8 @@
 use std::{mem, ptr};
 
-use rand::distributions::{Alphanumeric, DistString, Standard};
 use rand::Rng;
-use test::{black_box, Bencher};
+use rand::distributions::{Alphanumeric, DistString, Standard};
+use test::{Bencher, black_box};
 
 #[bench]
 fn iterator(b: &mut Bencher) {
diff --git a/library/alloc/benches/str.rs b/library/alloc/benches/str.rs
index c148ab6b220..f020638e992 100644
--- a/library/alloc/benches/str.rs
+++ b/library/alloc/benches/str.rs
@@ -1,4 +1,4 @@
-use test::{black_box, Bencher};
+use test::{Bencher, black_box};
 
 #[bench]
 fn char_iterator(b: &mut Bencher) {
diff --git a/library/alloc/benches/string.rs b/library/alloc/benches/string.rs
index e0dbe80d288..3d79ab78c69 100644
--- a/library/alloc/benches/string.rs
+++ b/library/alloc/benches/string.rs
@@ -1,6 +1,6 @@
 use std::iter::repeat;
 
-use test::{black_box, Bencher};
+use test::{Bencher, black_box};
 
 #[bench]
 fn bench_with_capacity(b: &mut Bencher) {
diff --git a/library/alloc/benches/vec.rs b/library/alloc/benches/vec.rs
index 13d784d3fd4..d29ffae9d70 100644
--- a/library/alloc/benches/vec.rs
+++ b/library/alloc/benches/vec.rs
@@ -1,7 +1,7 @@
 use std::iter::repeat;
 
 use rand::RngCore;
-use test::{black_box, Bencher};
+use test::{Bencher, black_box};
 
 #[bench]
 fn bench_new(b: &mut Bencher) {
diff --git a/library/alloc/benches/vec_deque.rs b/library/alloc/benches/vec_deque.rs
index fb1e2685cc3..a56f8496963 100644
--- a/library/alloc/benches/vec_deque.rs
+++ b/library/alloc/benches/vec_deque.rs
@@ -1,7 +1,7 @@
-use std::collections::{vec_deque, VecDeque};
+use std::collections::{VecDeque, vec_deque};
 use std::mem;
 
-use test::{black_box, Bencher};
+use test::{Bencher, black_box};
 
 #[bench]
 fn bench_new(b: &mut Bencher) {
diff --git a/library/alloc/src/boxed.rs b/library/alloc/src/boxed.rs
index 5978908e8f5..f61a484499f 100644
--- a/library/alloc/src/boxed.rs
+++ b/library/alloc/src/boxed.rs
@@ -199,7 +199,7 @@ use core::ops::{
     DerefPure, DispatchFromDyn, Receiver,
 };
 use core::pin::{Pin, PinCoerceUnsized};
-use core::ptr::{self, addr_of_mut, NonNull, Unique};
+use core::ptr::{self, NonNull, Unique, addr_of_mut};
 use core::task::{Context, Poll};
 use core::{borrow, fmt, slice};
 
@@ -2480,7 +2480,10 @@ impl<Args: Tuple, F: AsyncFnOnce<Args> + ?Sized, A: Allocator> AsyncFnOnce<Args>
 
 #[unstable(feature = "async_fn_traits", issue = "none")]
 impl<Args: Tuple, F: AsyncFnMut<Args> + ?Sized, A: Allocator> AsyncFnMut<Args> for Box<F, A> {
-    type CallRefFuture<'a> = F::CallRefFuture<'a> where Self: 'a;
+    type CallRefFuture<'a>
+        = F::CallRefFuture<'a>
+    where
+        Self: 'a;
 
     extern "rust-call" fn async_call_mut(&mut self, args: Args) -> Self::CallRefFuture<'_> {
         F::async_call_mut(self, args)
diff --git a/library/alloc/src/collections/binary_heap/mod.rs b/library/alloc/src/collections/binary_heap/mod.rs
index a19a044fc7e..5e59abf54ee 100644
--- a/library/alloc/src/collections/binary_heap/mod.rs
+++ b/library/alloc/src/collections/binary_heap/mod.rs
@@ -145,7 +145,7 @@
 
 use core::alloc::Allocator;
 use core::iter::{FusedIterator, InPlaceIterable, SourceIter, TrustedFused, TrustedLen};
-use core::mem::{self, swap, ManuallyDrop};
+use core::mem::{self, ManuallyDrop, swap};
 use core::num::NonZero;
 use core::ops::{Deref, DerefMut};
 use core::{fmt, ptr};
diff --git a/library/alloc/src/collections/binary_heap/tests.rs b/library/alloc/src/collections/binary_heap/tests.rs
index 1cb07c62149..c18318724a4 100644
--- a/library/alloc/src/collections/binary_heap/tests.rs
+++ b/library/alloc/src/collections/binary_heap/tests.rs
@@ -1,4 +1,4 @@
-use std::panic::{catch_unwind, AssertUnwindSafe};
+use std::panic::{AssertUnwindSafe, catch_unwind};
 
 use super::*;
 use crate::boxed::Box;
diff --git a/library/alloc/src/collections/btree/fix.rs b/library/alloc/src/collections/btree/fix.rs
index 4c1e19ead40..95fb52b7f77 100644
--- a/library/alloc/src/collections/btree/fix.rs
+++ b/library/alloc/src/collections/btree/fix.rs
@@ -3,7 +3,7 @@ use core::alloc::Allocator;
 use super::map::MIN_LEN;
 use super::node::ForceResult::*;
 use super::node::LeftOrRight::*;
-use super::node::{marker, Handle, NodeRef, Root};
+use super::node::{Handle, NodeRef, Root, marker};
 
 impl<'a, K: 'a, V: 'a> NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInternal> {
     /// Stocks up a possibly underfull node by merging with or stealing from a
diff --git a/library/alloc/src/collections/btree/map.rs b/library/alloc/src/collections/btree/map.rs
index 0eadc9ecac8..55649d865fc 100644
--- a/library/alloc/src/collections/btree/map.rs
+++ b/library/alloc/src/collections/btree/map.rs
@@ -13,7 +13,7 @@ use super::borrow::DormantMutRef;
 use super::dedup_sorted_iter::DedupSortedIter;
 use super::navigate::{LazyLeafRange, LeafRange};
 use super::node::ForceResult::*;
-use super::node::{self, marker, Handle, NodeRef, Root};
+use super::node::{self, Handle, NodeRef, Root, marker};
 use super::search::SearchBound;
 use super::search::SearchResult::*;
 use super::set_val::SetValZST;
@@ -22,9 +22,9 @@ use crate::vec::Vec;
 
 mod entry;
 
+use Entry::*;
 #[stable(feature = "rust1", since = "1.0.0")]
 pub use entry::{Entry, OccupiedEntry, OccupiedError, VacantEntry};
-use Entry::*;
 
 /// Minimum number of elements in a node that is not a root.
 /// We might temporarily have fewer elements during methods.
diff --git a/library/alloc/src/collections/btree/map/entry.rs b/library/alloc/src/collections/btree/map/entry.rs
index d128ad8ee5f..75bb86916a8 100644
--- a/library/alloc/src/collections/btree/map/entry.rs
+++ b/library/alloc/src/collections/btree/map/entry.rs
@@ -5,7 +5,7 @@ use core::mem;
 use Entry::*;
 
 use super::super::borrow::DormantMutRef;
-use super::super::node::{marker, Handle, NodeRef};
+use super::super::node::{Handle, NodeRef, marker};
 use super::BTreeMap;
 use crate::alloc::{Allocator, Global};
 
diff --git a/library/alloc/src/collections/btree/map/tests.rs b/library/alloc/src/collections/btree/map/tests.rs
index ff1254a5a0c..d0e413778f8 100644
--- a/library/alloc/src/collections/btree/map/tests.rs
+++ b/library/alloc/src/collections/btree/map/tests.rs
@@ -1,7 +1,7 @@
 use core::assert_matches::assert_matches;
 use std::iter;
 use std::ops::Bound::{Excluded, Included, Unbounded};
-use std::panic::{catch_unwind, AssertUnwindSafe};
+use std::panic::{AssertUnwindSafe, catch_unwind};
 use std::sync::atomic::AtomicUsize;
 use std::sync::atomic::Ordering::SeqCst;
 
diff --git a/library/alloc/src/collections/btree/navigate.rs b/library/alloc/src/collections/btree/navigate.rs
index f5c621e2c17..14b7d4ad71f 100644
--- a/library/alloc/src/collections/btree/navigate.rs
+++ b/library/alloc/src/collections/btree/navigate.rs
@@ -3,7 +3,7 @@ use core::ops::RangeBounds;
 use core::{hint, ptr};
 
 use super::node::ForceResult::*;
-use super::node::{marker, Handle, NodeRef};
+use super::node::{Handle, NodeRef, marker};
 use super::search::SearchBound;
 use crate::alloc::Allocator;
 // `front` and `back` are always both `None` or both `Some`.
diff --git a/library/alloc/src/collections/btree/remove.rs b/library/alloc/src/collections/btree/remove.rs
index c46422c2f1d..56f2824b782 100644
--- a/library/alloc/src/collections/btree/remove.rs
+++ b/library/alloc/src/collections/btree/remove.rs
@@ -3,7 +3,7 @@ use core::alloc::Allocator;
 use super::map::MIN_LEN;
 use super::node::ForceResult::*;
 use super::node::LeftOrRight::*;
-use super::node::{marker, Handle, NodeRef};
+use super::node::{Handle, NodeRef, marker};
 
 impl<'a, K: 'a, V: 'a> Handle<NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInternal>, marker::KV> {
     /// Removes a key-value pair from the tree, and returns that pair, as well as
diff --git a/library/alloc/src/collections/btree/search.rs b/library/alloc/src/collections/btree/search.rs
index 1d5c927175e..22e015edac3 100644
--- a/library/alloc/src/collections/btree/search.rs
+++ b/library/alloc/src/collections/btree/search.rs
@@ -6,7 +6,7 @@ use SearchBound::*;
 use SearchResult::*;
 
 use super::node::ForceResult::*;
-use super::node::{marker, Handle, NodeRef};
+use super::node::{Handle, NodeRef, marker};
 
 pub enum SearchBound<T> {
     /// An inclusive bound to look for, just like `Bound::Included(T)`.
diff --git a/library/alloc/src/collections/btree/set.rs b/library/alloc/src/collections/btree/set.rs
index 770cd80ea9c..a40209fa2e3 100644
--- a/library/alloc/src/collections/btree/set.rs
+++ b/library/alloc/src/collections/btree/set.rs
@@ -7,10 +7,10 @@ use core::iter::{FusedIterator, Peekable};
 use core::mem::ManuallyDrop;
 use core::ops::{BitAnd, BitOr, BitXor, Bound, RangeBounds, Sub};
 
+use super::Recover;
 use super::map::{BTreeMap, Keys};
 use super::merge_iter::MergeIterInner;
 use super::set_val::SetValZST;
-use super::Recover;
 use crate::alloc::{Allocator, Global};
 use crate::vec::Vec;
 
diff --git a/library/alloc/src/collections/btree/set/tests.rs b/library/alloc/src/collections/btree/set/tests.rs
index f947b6108c9..990044e069f 100644
--- a/library/alloc/src/collections/btree/set/tests.rs
+++ b/library/alloc/src/collections/btree/set/tests.rs
@@ -1,5 +1,5 @@
 use std::ops::Bound::{Excluded, Included};
-use std::panic::{catch_unwind, AssertUnwindSafe};
+use std::panic::{AssertUnwindSafe, catch_unwind};
 
 use super::*;
 use crate::testing::crash_test::{CrashTestDummy, Panic};
@@ -132,11 +132,9 @@ fn test_difference() {
     check_difference(&[1, 3, 5, 9, 11], &[3, 6, 9], &[1, 5, 11]);
     check_difference(&[1, 3, 5, 9, 11], &[0, 1], &[3, 5, 9, 11]);
     check_difference(&[1, 3, 5, 9, 11], &[11, 12], &[1, 3, 5, 9]);
-    check_difference(
-        &[-5, 11, 22, 33, 40, 42],
-        &[-12, -5, 14, 23, 34, 38, 39, 50],
-        &[11, 22, 33, 40, 42],
-    );
+    check_difference(&[-5, 11, 22, 33, 40, 42], &[-12, -5, 14, 23, 34, 38, 39, 50], &[
+        11, 22, 33, 40, 42,
+    ]);
 
     if cfg!(miri) {
         // Miri is too slow
@@ -252,11 +250,9 @@ fn test_union() {
     check_union(&[], &[], &[]);
     check_union(&[1, 2, 3], &[2], &[1, 2, 3]);
     check_union(&[2], &[1, 2, 3], &[1, 2, 3]);
-    check_union(
-        &[1, 3, 5, 9, 11, 16, 19, 24],
-        &[-2, 1, 5, 9, 13, 19],
-        &[-2, 1, 3, 5, 9, 11, 13, 16, 19, 24],
-    );
+    check_union(&[1, 3, 5, 9, 11, 16, 19, 24], &[-2, 1, 5, 9, 13, 19], &[
+        -2, 1, 3, 5, 9, 11, 13, 16, 19, 24,
+    ]);
 }
 
 #[test]
diff --git a/library/alloc/src/collections/linked_list/tests.rs b/library/alloc/src/collections/linked_list/tests.rs
index c93e5813b11..b7d4f8512a0 100644
--- a/library/alloc/src/collections/linked_list/tests.rs
+++ b/library/alloc/src/collections/linked_list/tests.rs
@@ -1,7 +1,7 @@
 // FIXME(static_mut_refs): Do not allow `static_mut_refs` lint
 #![allow(static_mut_refs)]
 
-use std::panic::{catch_unwind, AssertUnwindSafe};
+use std::panic::{AssertUnwindSafe, catch_unwind};
 use std::thread;
 
 use rand::RngCore;
@@ -696,10 +696,9 @@ fn test_cursor_mut_insert() {
     cursor.splice_after(p);
     cursor.splice_before(q);
     check_links(&m);
-    assert_eq!(
-        m.iter().cloned().collect::<Vec<_>>(),
-        &[200, 201, 202, 203, 1, 100, 101, 102, 103, 8, 2, 3, 4, 5, 6]
-    );
+    assert_eq!(m.iter().cloned().collect::<Vec<_>>(), &[
+        200, 201, 202, 203, 1, 100, 101, 102, 103, 8, 2, 3, 4, 5, 6
+    ]);
     let mut cursor = m.cursor_front_mut();
     cursor.move_prev();
     let tmp = cursor.split_before();
@@ -916,10 +915,9 @@ fn extract_if_complex() {
         assert_eq!(removed, vec![2, 4, 6, 18, 20, 22, 24, 26, 34, 36]);
 
         assert_eq!(list.len(), 14);
-        assert_eq!(
-            list.into_iter().collect::<Vec<_>>(),
-            vec![1, 7, 9, 11, 13, 15, 17, 27, 29, 31, 33, 35, 37, 39]
-        );
+        assert_eq!(list.into_iter().collect::<Vec<_>>(), vec![
+            1, 7, 9, 11, 13, 15, 17, 27, 29, 31, 33, 35, 37, 39
+        ]);
     }
 
     {
@@ -934,10 +932,9 @@ fn extract_if_complex() {
         assert_eq!(removed, vec![2, 4, 6, 18, 20, 22, 24, 26, 34, 36]);
 
         assert_eq!(list.len(), 13);
-        assert_eq!(
-            list.into_iter().collect::<Vec<_>>(),
-            vec![7, 9, 11, 13, 15, 17, 27, 29, 31, 33, 35, 37, 39]
-        );
+        assert_eq!(list.into_iter().collect::<Vec<_>>(), vec![
+            7, 9, 11, 13, 15, 17, 27, 29, 31, 33, 35, 37, 39
+        ]);
     }
 
     {
@@ -952,10 +949,9 @@ fn extract_if_complex() {
         assert_eq!(removed, vec![2, 4, 6, 18, 20, 22, 24, 26, 34, 36]);
 
         assert_eq!(list.len(), 11);
-        assert_eq!(
-            list.into_iter().collect::<Vec<_>>(),
-            vec![7, 9, 11, 13, 15, 17, 27, 29, 31, 33, 35]
-        );
+        assert_eq!(list.into_iter().collect::<Vec<_>>(), vec![
+            7, 9, 11, 13, 15, 17, 27, 29, 31, 33, 35
+        ]);
     }
 
     {
diff --git a/library/alloc/src/collections/vec_deque/mod.rs b/library/alloc/src/collections/vec_deque/mod.rs
index a438517b75b..b1759a486ac 100644
--- a/library/alloc/src/collections/vec_deque/mod.rs
+++ b/library/alloc/src/collections/vec_deque/mod.rs
@@ -9,7 +9,7 @@
 
 use core::cmp::{self, Ordering};
 use core::hash::{Hash, Hasher};
-use core::iter::{repeat_n, repeat_with, ByRefSized};
+use core::iter::{ByRefSized, repeat_n, repeat_with};
 // This is used in a bunch of intra-doc links.
 // FIXME: For some reason, `#[cfg(doc)]` wasn't sufficient, resulting in
 // failures in linkchecker even though rustdoc built the docs just fine.
diff --git a/library/alloc/src/collections/vec_deque/tests.rs b/library/alloc/src/collections/vec_deque/tests.rs
index c90679f1797..6328b3b4db8 100644
--- a/library/alloc/src/collections/vec_deque/tests.rs
+++ b/library/alloc/src/collections/vec_deque/tests.rs
@@ -562,10 +562,9 @@ fn make_contiguous_head_to_end() {
         tester.push_front(i as char);
     }
 
-    assert_eq!(
-        tester,
-        ['P', 'O', 'N', 'M', 'L', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K']
-    );
+    assert_eq!(tester, [
+        'P', 'O', 'N', 'M', 'L', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K'
+    ]);
 
     // ABCDEFGHIJKPONML
     let expected_start = 0;
diff --git a/library/alloc/src/ffi/c_str.rs b/library/alloc/src/ffi/c_str.rs
index 45037aa1615..797d591a8b5 100644
--- a/library/alloc/src/ffi/c_str.rs
+++ b/library/alloc/src/ffi/c_str.rs
@@ -4,7 +4,7 @@
 mod tests;
 
 use core::borrow::Borrow;
-use core::ffi::{c_char, CStr};
+use core::ffi::{CStr, c_char};
 use core::num::NonZero;
 use core::slice::memchr;
 use core::str::{self, Utf8Error};
diff --git a/library/alloc/src/fmt.rs b/library/alloc/src/fmt.rs
index 571fcd177aa..3da71038a5e 100644
--- a/library/alloc/src/fmt.rs
+++ b/library/alloc/src/fmt.rs
@@ -580,10 +580,8 @@
 pub use core::fmt::Alignment;
 #[stable(feature = "rust1", since = "1.0.0")]
 pub use core::fmt::Error;
-#[unstable(feature = "debug_closure_helpers", issue = "117729")]
-pub use core::fmt::{from_fn, FromFn};
 #[stable(feature = "rust1", since = "1.0.0")]
-pub use core::fmt::{write, Arguments};
+pub use core::fmt::{Arguments, write};
 #[stable(feature = "rust1", since = "1.0.0")]
 pub use core::fmt::{Binary, Octal};
 #[stable(feature = "rust1", since = "1.0.0")]
@@ -592,6 +590,8 @@ pub use core::fmt::{Debug, Display};
 pub use core::fmt::{DebugList, DebugMap, DebugSet, DebugStruct, DebugTuple};
 #[stable(feature = "rust1", since = "1.0.0")]
 pub use core::fmt::{Formatter, Result, Write};
+#[unstable(feature = "debug_closure_helpers", issue = "117729")]
+pub use core::fmt::{FromFn, from_fn};
 #[stable(feature = "rust1", since = "1.0.0")]
 pub use core::fmt::{LowerExp, UpperExp};
 #[stable(feature = "rust1", since = "1.0.0")]
diff --git a/library/alloc/src/rc.rs b/library/alloc/src/rc.rs
index b9a92749aae..54669bd310a 100644
--- a/library/alloc/src/rc.rs
+++ b/library/alloc/src/rc.rs
@@ -251,13 +251,13 @@ use core::intrinsics::abort;
 #[cfg(not(no_global_oom_handling))]
 use core::iter;
 use core::marker::{PhantomData, Unsize};
-use core::mem::{self, align_of_val_raw, ManuallyDrop};
+use core::mem::{self, ManuallyDrop, align_of_val_raw};
 use core::ops::{CoerceUnsized, Deref, DerefMut, DerefPure, DispatchFromDyn, Receiver};
 use core::panic::{RefUnwindSafe, UnwindSafe};
 #[cfg(not(no_global_oom_handling))]
 use core::pin::Pin;
 use core::pin::PinCoerceUnsized;
-use core::ptr::{self, drop_in_place, NonNull};
+use core::ptr::{self, NonNull, drop_in_place};
 #[cfg(not(no_global_oom_handling))]
 use core::slice::from_raw_parts_mut;
 use core::{borrow, fmt, hint};
diff --git a/library/alloc/src/slice.rs b/library/alloc/src/slice.rs
index 45fb88969c6..f636f10d5c0 100644
--- a/library/alloc/src/slice.rs
+++ b/library/alloc/src/slice.rs
@@ -43,14 +43,6 @@ pub use core::slice::ArrayWindows;
 pub use core::slice::EscapeAscii;
 #[stable(feature = "slice_get_slice", since = "1.28.0")]
 pub use core::slice::SliceIndex;
-#[stable(feature = "from_ref", since = "1.28.0")]
-pub use core::slice::{from_mut, from_ref};
-#[unstable(feature = "slice_from_ptr_range", issue = "89792")]
-pub use core::slice::{from_mut_ptr_range, from_ptr_range};
-#[stable(feature = "rust1", since = "1.0.0")]
-pub use core::slice::{from_raw_parts, from_raw_parts_mut};
-#[unstable(feature = "slice_range", issue = "76393")]
-pub use core::slice::{range, try_range};
 #[stable(feature = "slice_group_by", since = "1.77.0")]
 pub use core::slice::{ChunkBy, ChunkByMut};
 #[stable(feature = "rust1", since = "1.0.0")]
@@ -69,6 +61,14 @@ pub use core::slice::{RSplit, RSplitMut};
 pub use core::slice::{RSplitN, RSplitNMut, SplitN, SplitNMut};
 #[stable(feature = "split_inclusive", since = "1.51.0")]
 pub use core::slice::{SplitInclusive, SplitInclusiveMut};
+#[stable(feature = "from_ref", since = "1.28.0")]
+pub use core::slice::{from_mut, from_ref};
+#[unstable(feature = "slice_from_ptr_range", issue = "89792")]
+pub use core::slice::{from_mut_ptr_range, from_ptr_range};
+#[stable(feature = "rust1", since = "1.0.0")]
+pub use core::slice::{from_raw_parts, from_raw_parts_mut};
+#[unstable(feature = "slice_range", issue = "76393")]
+pub use core::slice::{range, try_range};
 
 ////////////////////////////////////////////////////////////////////////////////
 // Basic slice extension methods
diff --git a/library/alloc/src/str.rs b/library/alloc/src/str.rs
index d7fba3ae159..32212b61c6e 100644
--- a/library/alloc/src/str.rs
+++ b/library/alloc/src/str.rs
@@ -9,9 +9,6 @@
 
 use core::borrow::{Borrow, BorrowMut};
 use core::iter::FusedIterator;
-#[stable(feature = "rust1", since = "1.0.0")]
-pub use core::str::pattern;
-use core::str::pattern::{DoubleEndedSearcher, Pattern, ReverseSearcher, Searcher};
 #[stable(feature = "encode_utf16", since = "1.8.0")]
 pub use core::str::EncodeUtf16;
 #[stable(feature = "split_ascii_whitespace", since = "1.34.0")]
@@ -20,12 +17,11 @@ pub use core::str::SplitAsciiWhitespace;
 pub use core::str::SplitInclusive;
 #[stable(feature = "rust1", since = "1.0.0")]
 pub use core::str::SplitWhitespace;
-#[unstable(feature = "str_from_raw_parts", issue = "119206")]
-pub use core::str::{from_raw_parts, from_raw_parts_mut};
 #[stable(feature = "rust1", since = "1.0.0")]
-pub use core::str::{from_utf8, from_utf8_mut, Bytes, CharIndices, Chars};
+pub use core::str::pattern;
+use core::str::pattern::{DoubleEndedSearcher, Pattern, ReverseSearcher, Searcher};
 #[stable(feature = "rust1", since = "1.0.0")]
-pub use core::str::{from_utf8_unchecked, from_utf8_unchecked_mut, ParseBoolError};
+pub use core::str::{Bytes, CharIndices, Chars, from_utf8, from_utf8_mut};
 #[stable(feature = "str_escape", since = "1.34.0")]
 pub use core::str::{EscapeDebug, EscapeDefault, EscapeUnicode};
 #[stable(feature = "rust1", since = "1.0.0")]
@@ -38,6 +34,8 @@ pub use core::str::{MatchIndices, RMatchIndices};
 #[stable(feature = "rust1", since = "1.0.0")]
 pub use core::str::{Matches, RMatches};
 #[stable(feature = "rust1", since = "1.0.0")]
+pub use core::str::{ParseBoolError, from_utf8_unchecked, from_utf8_unchecked_mut};
+#[stable(feature = "rust1", since = "1.0.0")]
 pub use core::str::{RSplit, Split};
 #[stable(feature = "rust1", since = "1.0.0")]
 pub use core::str::{RSplitN, SplitN};
@@ -45,6 +43,8 @@ pub use core::str::{RSplitN, SplitN};
 pub use core::str::{RSplitTerminator, SplitTerminator};
 #[stable(feature = "utf8_chunks", since = "1.79.0")]
 pub use core::str::{Utf8Chunk, Utf8Chunks};
+#[unstable(feature = "str_from_raw_parts", issue = "119206")]
+pub use core::str::{from_raw_parts, from_raw_parts_mut};
 use core::unicode::conversions;
 use core::{mem, ptr};
 
diff --git a/library/alloc/src/string.rs b/library/alloc/src/string.rs
index 83977350832..ee878e879e9 100644
--- a/library/alloc/src/string.rs
+++ b/library/alloc/src/string.rs
@@ -43,9 +43,9 @@
 #![stable(feature = "rust1", since = "1.0.0")]
 
 use core::error::Error;
+use core::iter::FusedIterator;
 #[cfg(not(no_global_oom_handling))]
 use core::iter::from_fn;
-use core::iter::FusedIterator;
 #[cfg(not(no_global_oom_handling))]
 use core::ops::Add;
 #[cfg(not(no_global_oom_handling))]
@@ -62,9 +62,9 @@ use crate::alloc::Allocator;
 use crate::borrow::{Cow, ToOwned};
 use crate::boxed::Box;
 use crate::collections::TryReserveError;
-use crate::str::{self, from_utf8_unchecked_mut, Chars, Utf8Error};
+use crate::str::{self, Chars, Utf8Error, from_utf8_unchecked_mut};
 #[cfg(not(no_global_oom_handling))]
-use crate::str::{from_boxed_utf8_unchecked, FromStr};
+use crate::str::{FromStr, from_boxed_utf8_unchecked};
 use crate::vec::Vec;
 
 /// A UTF-8–encoded, growable string.
diff --git a/library/alloc/src/sync.rs b/library/alloc/src/sync.rs
index 4d4e84bfda5..50886244d58 100644
--- a/library/alloc/src/sync.rs
+++ b/library/alloc/src/sync.rs
@@ -17,7 +17,7 @@ use core::intrinsics::abort;
 #[cfg(not(no_global_oom_handling))]
 use core::iter;
 use core::marker::{PhantomData, Unsize};
-use core::mem::{self, align_of_val_raw, ManuallyDrop};
+use core::mem::{self, ManuallyDrop, align_of_val_raw};
 use core::ops::{CoerceUnsized, Deref, DerefPure, DispatchFromDyn, Receiver};
 use core::panic::{RefUnwindSafe, UnwindSafe};
 use core::pin::{Pin, PinCoerceUnsized};
diff --git a/library/alloc/src/sync/tests.rs b/library/alloc/src/sync/tests.rs
index d6b3de87577..3f66c889923 100644
--- a/library/alloc/src/sync/tests.rs
+++ b/library/alloc/src/sync/tests.rs
@@ -1,10 +1,10 @@
 use std::clone::Clone;
 use std::mem::MaybeUninit;
 use std::option::Option::None;
+use std::sync::Mutex;
 use std::sync::atomic::AtomicUsize;
 use std::sync::atomic::Ordering::SeqCst;
 use std::sync::mpsc::channel;
-use std::sync::Mutex;
 use std::thread;
 
 use super::*;
diff --git a/library/alloc/src/vec/in_place_collect.rs b/library/alloc/src/vec/in_place_collect.rs
index 23dbc3b63f9..fd94bbbdeb1 100644
--- a/library/alloc/src/vec/in_place_collect.rs
+++ b/library/alloc/src/vec/in_place_collect.rs
@@ -163,7 +163,7 @@ use core::num::NonZero;
 use core::ptr;
 
 use super::{InPlaceDrop, InPlaceDstDataSrcBufDrop, SpecFromIter, SpecFromIterNested, Vec};
-use crate::alloc::{handle_alloc_error, Global};
+use crate::alloc::{Global, handle_alloc_error};
 
 const fn in_place_collectible<DEST, SRC>(
     step_merge: Option<NonZero<usize>>,
diff --git a/library/alloc/src/vec/in_place_drop.rs b/library/alloc/src/vec/in_place_drop.rs
index 27f75979310..4d5b4e47d39 100644
--- a/library/alloc/src/vec/in_place_drop.rs
+++ b/library/alloc/src/vec/in_place_drop.rs
@@ -1,5 +1,5 @@
 use core::marker::PhantomData;
-use core::ptr::{self, drop_in_place, NonNull};
+use core::ptr::{self, NonNull, drop_in_place};
 use core::slice::{self};
 
 use crate::alloc::Global;
diff --git a/library/alloc/tests/slice.rs b/library/alloc/tests/slice.rs
index df5a8af16fd..9625e3d2b5e 100644
--- a/library/alloc/tests/slice.rs
+++ b/library/alloc/tests/slice.rs
@@ -1417,8 +1417,8 @@ fn test_box_slice_clone() {
 #[cfg_attr(target_os = "emscripten", ignore)]
 #[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
 fn test_box_slice_clone_panics() {
-    use std::sync::atomic::{AtomicUsize, Ordering};
     use std::sync::Arc;
+    use std::sync::atomic::{AtomicUsize, Ordering};
 
     struct Canary {
         count: Arc<AtomicUsize>,
diff --git a/library/alloc/tests/str.rs b/library/alloc/tests/str.rs
index a6b1fe5b979..a80e5275dab 100644
--- a/library/alloc/tests/str.rs
+++ b/library/alloc/tests/str.rs
@@ -1524,14 +1524,18 @@ fn test_lines() {
     t("bare\r", &["bare\r"]);
     t("bare\rcr", &["bare\rcr"]);
     t("Text\n\r", &["Text", "\r"]);
-    t(
-        "\nMäry häd ä little lämb\n\r\nLittle lämb\n",
-        &["", "Märy häd ä little lämb", "", "Little lämb"],
-    );
-    t(
-        "\r\nMäry häd ä little lämb\n\nLittle lämb",
-        &["", "Märy häd ä little lämb", "", "Little lämb"],
-    );
+    t("\nMäry häd ä little lämb\n\r\nLittle lämb\n", &[
+        "",
+        "Märy häd ä little lämb",
+        "",
+        "Little lämb",
+    ]);
+    t("\r\nMäry häd ä little lämb\n\nLittle lämb", &[
+        "",
+        "Märy häd ä little lämb",
+        "",
+        "Little lämb",
+    ]);
 }
 
 #[test]
@@ -1971,88 +1975,73 @@ mod pattern {
         assert_eq!(v, right);
     }
 
-    make_test!(
-        str_searcher_ascii_haystack,
-        "bb",
-        "abbcbbd",
-        [Reject(0, 1), Match(1, 3), Reject(3, 4), Match(4, 6), Reject(6, 7),]
-    );
-    make_test!(
-        str_searcher_ascii_haystack_seq,
-        "bb",
-        "abbcbbbbd",
-        [Reject(0, 1), Match(1, 3), Reject(3, 4), Match(4, 6), Match(6, 8), Reject(8, 9),]
-    );
-    make_test!(
-        str_searcher_empty_needle_ascii_haystack,
-        "",
-        "abbcbbd",
-        [
-            Match(0, 0),
-            Reject(0, 1),
-            Match(1, 1),
-            Reject(1, 2),
-            Match(2, 2),
-            Reject(2, 3),
-            Match(3, 3),
-            Reject(3, 4),
-            Match(4, 4),
-            Reject(4, 5),
-            Match(5, 5),
-            Reject(5, 6),
-            Match(6, 6),
-            Reject(6, 7),
-            Match(7, 7),
-        ]
-    );
-    make_test!(
-        str_searcher_multibyte_haystack,
-        " ",
-        "├──",
-        [Reject(0, 3), Reject(3, 6), Reject(6, 9),]
-    );
-    make_test!(
-        str_searcher_empty_needle_multibyte_haystack,
-        "",
-        "├──",
-        [
-            Match(0, 0),
-            Reject(0, 3),
-            Match(3, 3),
-            Reject(3, 6),
-            Match(6, 6),
-            Reject(6, 9),
-            Match(9, 9),
-        ]
-    );
+    make_test!(str_searcher_ascii_haystack, "bb", "abbcbbd", [
+        Reject(0, 1),
+        Match(1, 3),
+        Reject(3, 4),
+        Match(4, 6),
+        Reject(6, 7),
+    ]);
+    make_test!(str_searcher_ascii_haystack_seq, "bb", "abbcbbbbd", [
+        Reject(0, 1),
+        Match(1, 3),
+        Reject(3, 4),
+        Match(4, 6),
+        Match(6, 8),
+        Reject(8, 9),
+    ]);
+    make_test!(str_searcher_empty_needle_ascii_haystack, "", "abbcbbd", [
+        Match(0, 0),
+        Reject(0, 1),
+        Match(1, 1),
+        Reject(1, 2),
+        Match(2, 2),
+        Reject(2, 3),
+        Match(3, 3),
+        Reject(3, 4),
+        Match(4, 4),
+        Reject(4, 5),
+        Match(5, 5),
+        Reject(5, 6),
+        Match(6, 6),
+        Reject(6, 7),
+        Match(7, 7),
+    ]);
+    make_test!(str_searcher_multibyte_haystack, " ", "├──", [
+        Reject(0, 3),
+        Reject(3, 6),
+        Reject(6, 9),
+    ]);
+    make_test!(str_searcher_empty_needle_multibyte_haystack, "", "├──", [
+        Match(0, 0),
+        Reject(0, 3),
+        Match(3, 3),
+        Reject(3, 6),
+        Match(6, 6),
+        Reject(6, 9),
+        Match(9, 9),
+    ]);
     make_test!(str_searcher_empty_needle_empty_haystack, "", "", [Match(0, 0),]);
     make_test!(str_searcher_nonempty_needle_empty_haystack, "├", "", []);
-    make_test!(
-        char_searcher_ascii_haystack,
-        'b',
-        "abbcbbd",
-        [
-            Reject(0, 1),
-            Match(1, 2),
-            Match(2, 3),
-            Reject(3, 4),
-            Match(4, 5),
-            Match(5, 6),
-            Reject(6, 7),
-        ]
-    );
-    make_test!(
-        char_searcher_multibyte_haystack,
-        ' ',
-        "├──",
-        [Reject(0, 3), Reject(3, 6), Reject(6, 9),]
-    );
-    make_test!(
-        char_searcher_short_haystack,
-        '\u{1F4A9}',
-        "* \t",
-        [Reject(0, 1), Reject(1, 2), Reject(2, 3),]
-    );
+    make_test!(char_searcher_ascii_haystack, 'b', "abbcbbd", [
+        Reject(0, 1),
+        Match(1, 2),
+        Match(2, 3),
+        Reject(3, 4),
+        Match(4, 5),
+        Match(5, 6),
+        Reject(6, 7),
+    ]);
+    make_test!(char_searcher_multibyte_haystack, ' ', "├──", [
+        Reject(0, 3),
+        Reject(3, 6),
+        Reject(6, 9),
+    ]);
+    make_test!(char_searcher_short_haystack, '\u{1F4A9}', "* \t", [
+        Reject(0, 1),
+        Reject(1, 2),
+        Reject(2, 3),
+    ]);
 
     // See #85462
     #[test]
diff --git a/library/alloc/tests/string.rs b/library/alloc/tests/string.rs
index d996c55f946..1c8bff1564d 100644
--- a/library/alloc/tests/string.rs
+++ b/library/alloc/tests/string.rs
@@ -154,28 +154,19 @@ fn test_fromutf8error_into_lossy() {
 #[test]
 fn test_from_utf16() {
     let pairs = [
-        (
-            String::from("𐍅𐌿𐌻𐍆𐌹𐌻𐌰\n"),
-            vec![
-                0xd800, 0xdf45, 0xd800, 0xdf3f, 0xd800, 0xdf3b, 0xd800, 0xdf46, 0xd800, 0xdf39,
-                0xd800, 0xdf3b, 0xd800, 0xdf30, 0x000a,
-            ],
-        ),
-        (
-            String::from("𐐒𐑉𐐮𐑀𐐲𐑋 𐐏𐐲𐑍\n"),
-            vec![
-                0xd801, 0xdc12, 0xd801, 0xdc49, 0xd801, 0xdc2e, 0xd801, 0xdc40, 0xd801, 0xdc32,
-                0xd801, 0xdc4b, 0x0020, 0xd801, 0xdc0f, 0xd801, 0xdc32, 0xd801, 0xdc4d, 0x000a,
-            ],
-        ),
-        (
-            String::from("𐌀𐌖𐌋𐌄𐌑𐌉·𐌌𐌄𐌕𐌄𐌋𐌉𐌑\n"),
-            vec![
-                0xd800, 0xdf00, 0xd800, 0xdf16, 0xd800, 0xdf0b, 0xd800, 0xdf04, 0xd800, 0xdf11,
-                0xd800, 0xdf09, 0x00b7, 0xd800, 0xdf0c, 0xd800, 0xdf04, 0xd800, 0xdf15, 0xd800,
-                0xdf04, 0xd800, 0xdf0b, 0xd800, 0xdf09, 0xd800, 0xdf11, 0x000a,
-            ],
-        ),
+        (String::from("𐍅𐌿𐌻𐍆𐌹𐌻𐌰\n"), vec![
+            0xd800, 0xdf45, 0xd800, 0xdf3f, 0xd800, 0xdf3b, 0xd800, 0xdf46, 0xd800, 0xdf39, 0xd800,
+            0xdf3b, 0xd800, 0xdf30, 0x000a,
+        ]),
+        (String::from("𐐒𐑉𐐮𐑀𐐲𐑋 𐐏𐐲𐑍\n"), vec![
+            0xd801, 0xdc12, 0xd801, 0xdc49, 0xd801, 0xdc2e, 0xd801, 0xdc40, 0xd801, 0xdc32, 0xd801,
+            0xdc4b, 0x0020, 0xd801, 0xdc0f, 0xd801, 0xdc32, 0xd801, 0xdc4d, 0x000a,
+        ]),
+        (String::from("𐌀𐌖𐌋𐌄𐌑𐌉·𐌌𐌄𐌕𐌄𐌋𐌉𐌑\n"), vec![
+            0xd800, 0xdf00, 0xd800, 0xdf16, 0xd800, 0xdf0b, 0xd800, 0xdf04, 0xd800, 0xdf11, 0xd800,
+            0xdf09, 0x00b7, 0xd800, 0xdf0c, 0xd800, 0xdf04, 0xd800, 0xdf15, 0xd800, 0xdf04, 0xd800,
+            0xdf0b, 0xd800, 0xdf09, 0xd800, 0xdf11, 0x000a,
+        ]),
         (
             String::from("𐒋𐒘𐒈𐒑𐒛𐒒 𐒕𐒓 𐒈𐒚𐒍 𐒏𐒜𐒒𐒖𐒆 𐒕𐒆\n"),
             vec![
diff --git a/library/alloc/tests/vec.rs b/library/alloc/tests/vec.rs
index cf2ca4f0d65..f508a3e4c22 100644
--- a/library/alloc/tests/vec.rs
+++ b/library/alloc/tests/vec.rs
@@ -14,7 +14,7 @@ use std::fmt::Debug;
 use std::iter::InPlaceIterable;
 use std::mem::{size_of, swap};
 use std::ops::Bound::*;
-use std::panic::{catch_unwind, AssertUnwindSafe};
+use std::panic::{AssertUnwindSafe, catch_unwind};
 use std::rc::Rc;
 use std::sync::atomic::{AtomicU32, Ordering};
 use std::vec::{Drain, IntoIter};
diff --git a/library/alloc/tests/vec_deque.rs b/library/alloc/tests/vec_deque.rs
index 0891d99fe66..4b8d3c735f7 100644
--- a/library/alloc/tests/vec_deque.rs
+++ b/library/alloc/tests/vec_deque.rs
@@ -3,12 +3,12 @@
 
 use core::num::NonZero;
 use std::assert_matches::assert_matches;
-use std::collections::vec_deque::Drain;
 use std::collections::TryReserveErrorKind::*;
 use std::collections::VecDeque;
+use std::collections::vec_deque::Drain;
 use std::fmt::Debug;
 use std::ops::Bound::*;
-use std::panic::{catch_unwind, AssertUnwindSafe};
+use std::panic::{AssertUnwindSafe, catch_unwind};
 
 use Taggy::*;
 use Taggypar::*;
diff --git a/library/alloc/tests/vec_deque_alloc_error.rs b/library/alloc/tests/vec_deque_alloc_error.rs
index c41d8266eb4..21a9118a05b 100644
--- a/library/alloc/tests/vec_deque_alloc_error.rs
+++ b/library/alloc/tests/vec_deque_alloc_error.rs
@@ -1,8 +1,8 @@
 #![feature(alloc_error_hook, allocator_api)]
 
-use std::alloc::{set_alloc_error_hook, AllocError, Allocator, Layout, System};
+use std::alloc::{AllocError, Allocator, Layout, System, set_alloc_error_hook};
 use std::collections::VecDeque;
-use std::panic::{catch_unwind, AssertUnwindSafe};
+use std::panic::{AssertUnwindSafe, catch_unwind};
 use std::ptr::NonNull;
 
 #[test]