Skip to content

Commit d1d4fb3

Browse files
committed
Reformat use declarations.
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
1 parent 06a22c9 commit d1d4fb3

File tree

524 files changed

+1546
-2192
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

524 files changed

+1546
-2192
lines changed

alloc/benches/btree/map.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
use std::collections::BTreeMap;
22
use std::ops::RangeBounds;
33

4-
use rand::{seq::SliceRandom, Rng};
4+
use rand::seq::SliceRandom;
5+
use rand::Rng;
56
use test::{black_box, Bencher};
67

78
macro_rules! map_insert_rand_bench {

alloc/benches/linked_list.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use std::collections::LinkedList;
2+
23
use test::Bencher;
34

45
#[bench]

alloc/benches/string.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use std::iter::repeat;
2+
23
use test::{black_box, Bencher};
34

45
#[bench]

alloc/benches/vec.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
use rand::RngCore;
21
use std::iter::repeat;
2+
3+
use rand::RngCore;
34
use test::{black_box, Bencher};
45

56
#[bench]

alloc/benches/vec_deque.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
use std::{
2-
collections::{vec_deque, VecDeque},
3-
mem,
4-
};
1+
use std::collections::{vec_deque, VecDeque};
2+
use std::mem;
3+
54
use test::{black_box, Bencher};
65

76
#[bench]

alloc/benches/vec_deque_append.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
use std::{collections::VecDeque, time::Instant};
1+
use std::collections::VecDeque;
2+
use std::time::Instant;
23

34
const VECDEQUE_LEN: i32 = 100000;
45
const WARMUP_N: usize = 100;

alloc/src/alloc.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,14 @@
22
33
#![stable(feature = "alloc_module", since = "1.28.0")]
44

5+
#[stable(feature = "alloc_module", since = "1.28.0")]
6+
#[doc(inline)]
7+
pub use core::alloc::*;
58
#[cfg(not(test))]
69
use core::hint;
7-
810
#[cfg(not(test))]
911
use core::ptr::{self, NonNull};
1012

11-
#[stable(feature = "alloc_module", since = "1.28.0")]
12-
#[doc(inline)]
13-
pub use core::alloc::*;
14-
1513
#[cfg(test)]
1614
mod tests;
1715

alloc/src/alloc/tests.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
use super::*;
22

33
extern crate test;
4-
use crate::boxed::Box;
54
use test::Bencher;
65

6+
use crate::boxed::Box;
7+
78
#[test]
89
fn allocate_zeroed() {
910
unsafe {

alloc/src/borrow.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,20 @@
22
33
#![stable(feature = "rust1", since = "1.0.0")]
44

5+
#[stable(feature = "rust1", since = "1.0.0")]
6+
pub use core::borrow::{Borrow, BorrowMut};
57
use core::cmp::Ordering;
68
use core::hash::{Hash, Hasher};
79
#[cfg(not(no_global_oom_handling))]
810
use core::ops::{Add, AddAssign};
911
use core::ops::{Deref, DerefPure};
1012

11-
#[stable(feature = "rust1", since = "1.0.0")]
12-
pub use core::borrow::{Borrow, BorrowMut};
13+
use Cow::*;
1314

1415
use crate::fmt;
1516
#[cfg(not(no_global_oom_handling))]
1617
use crate::string::String;
1718

18-
use Cow::*;
19-
2019
#[stable(feature = "rust1", since = "1.0.0")]
2120
impl<'a, B: ?Sized> Borrow<B> for Cow<'a, B>
2221
where

alloc/src/boxed.rs

+7-10
Original file line numberDiff line numberDiff line change
@@ -187,26 +187,26 @@
187187

188188
use core::any::Any;
189189
use core::async_iter::AsyncIterator;
190-
use core::borrow;
191190
#[cfg(not(no_global_oom_handling))]
192191
use core::clone::CloneToUninit;
193192
use core::cmp::Ordering;
194193
use core::error::Error;
195-
use core::fmt;
196194
use core::future::Future;
197195
use core::hash::{Hash, Hasher};
198196
use core::iter::FusedIterator;
199-
use core::marker::Tuple;
200-
use core::marker::Unsize;
197+
use core::marker::{Tuple, Unsize};
201198
use core::mem::{self, SizedTypeProperties};
202-
use core::ops::{AsyncFn, AsyncFnMut, AsyncFnOnce};
203199
use core::ops::{
204-
CoerceUnsized, Coroutine, CoroutineState, Deref, DerefMut, DerefPure, DispatchFromDyn, Receiver,
200+
AsyncFn, AsyncFnMut, AsyncFnOnce, CoerceUnsized, Coroutine, CoroutineState, Deref, DerefMut,
201+
DerefPure, DispatchFromDyn, Receiver,
205202
};
206203
use core::pin::Pin;
207204
use core::ptr::{self, addr_of_mut, NonNull, Unique};
208-
use core::slice;
209205
use core::task::{Context, Poll};
206+
use core::{borrow, fmt, slice};
207+
208+
#[unstable(feature = "thin_box", issue = "92791")]
209+
pub use thin::ThinBox;
210210

211211
#[cfg(not(no_global_oom_handling))]
212212
use crate::alloc::handle_alloc_error;
@@ -222,9 +222,6 @@ use crate::vec;
222222
#[cfg(not(no_global_oom_handling))]
223223
use crate::vec::Vec;
224224

225-
#[unstable(feature = "thin_box", issue = "92791")]
226-
pub use thin::ThinBox;
227-
228225
mod thin;
229226

230227
/// A pointer type that uniquely owns a heap allocation of type `T`.

alloc/src/boxed/thin.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
//! <https://github.com/matthieu-m/rfc2580/blob/b58d1d3cba0d4b5e859d3617ea2d0943aaa31329/examples/thin.rs>
33
//! by matthieu-m
44
5-
use crate::alloc::{self, Layout, LayoutError};
65
use core::error::Error;
76
use core::fmt::{self, Debug, Display, Formatter};
87
#[cfg(not(no_global_oom_handling))]
@@ -14,8 +13,9 @@ use core::mem;
1413
#[cfg(not(no_global_oom_handling))]
1514
use core::mem::SizedTypeProperties;
1615
use core::ops::{Deref, DerefMut};
17-
use core::ptr::Pointee;
18-
use core::ptr::{self, NonNull};
16+
use core::ptr::{self, NonNull, Pointee};
17+
18+
use crate::alloc::{self, Layout, LayoutError};
1919

2020
/// ThinBox.
2121
///

alloc/src/collections/binary_heap/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,11 @@
144144
#![stable(feature = "rust1", since = "1.0.0")]
145145

146146
use core::alloc::Allocator;
147-
use core::fmt;
148147
use core::iter::{FusedIterator, InPlaceIterable, SourceIter, TrustedFused, TrustedLen};
149148
use core::mem::{self, swap, ManuallyDrop};
150149
use core::num::NonZero;
151150
use core::ops::{Deref, DerefMut};
152-
use core::ptr;
151+
use core::{fmt, ptr};
153152

154153
use crate::alloc::Global;
155154
use crate::collections::TryReserveError;

alloc/src/collections/binary_heap/tests.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
use std::panic::{catch_unwind, AssertUnwindSafe};
2+
13
use super::*;
24
use crate::boxed::Box;
35
use crate::testing::crash_test::{CrashTestDummy, Panic};
4-
use std::panic::{catch_unwind, AssertUnwindSafe};
56

67
#[test]
78
fn test_iterator() {
@@ -504,11 +505,12 @@ fn test_retain_catch_unwind() {
504505
#[cfg(not(target_os = "emscripten"))]
505506
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
506507
fn panic_safe() {
507-
use rand::seq::SliceRandom;
508508
use std::cmp;
509509
use std::panic::{self, AssertUnwindSafe};
510510
use std::sync::atomic::{AtomicUsize, Ordering};
511511

512+
use rand::seq::SliceRandom;
513+
512514
static DROP_COUNTER: AtomicUsize = AtomicUsize::new(0);
513515

514516
#[derive(Eq, PartialEq, Ord, Clone, Debug)]

alloc/src/collections/btree/append.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
use super::merge_iter::MergeIterInner;
2-
use super::node::{self, Root};
31
use core::alloc::Allocator;
42
use core::iter::FusedIterator;
53

4+
use super::merge_iter::MergeIterInner;
5+
use super::node::{self, Root};
6+
67
impl<K, V> Root<K, V> {
78
/// Appends all key-value pairs from the union of two ascending iterators,
89
/// incrementing a `length` variable along the way. The latter makes it

alloc/src/collections/btree/fix.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
use super::map::MIN_LEN;
2-
use super::node::{marker, ForceResult::*, Handle, LeftOrRight::*, NodeRef, Root};
31
use core::alloc::Allocator;
42

3+
use super::map::MIN_LEN;
4+
use super::node::ForceResult::*;
5+
use super::node::LeftOrRight::*;
6+
use super::node::{marker, Handle, NodeRef, Root};
7+
58
impl<'a, K: 'a, V: 'a> NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInternal> {
69
/// Stocks up a possibly underfull node by merging with or stealing from a
710
/// sibling. If successful but at the cost of shrinking the parent node,

alloc/src/collections/btree/map.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use crate::vec::Vec;
21
use core::borrow::Borrow;
32
use core::cmp::Ordering;
43
use core::error::Error;
@@ -10,20 +9,21 @@ use core::mem::{self, ManuallyDrop};
109
use core::ops::{Bound, Index, RangeBounds};
1110
use core::ptr;
1211

13-
use crate::alloc::{Allocator, Global};
14-
1512
use super::borrow::DormantMutRef;
1613
use super::dedup_sorted_iter::DedupSortedIter;
1714
use super::navigate::{LazyLeafRange, LeafRange};
18-
use super::node::{self, marker, ForceResult::*, Handle, NodeRef, Root};
19-
use super::search::{SearchBound, SearchResult::*};
15+
use super::node::ForceResult::*;
16+
use super::node::{self, marker, Handle, NodeRef, Root};
17+
use super::search::SearchBound;
18+
use super::search::SearchResult::*;
2019
use super::set_val::SetValZST;
20+
use crate::alloc::{Allocator, Global};
21+
use crate::vec::Vec;
2122

2223
mod entry;
2324

2425
#[stable(feature = "rust1", since = "1.0.0")]
2526
pub use entry::{Entry, OccupiedEntry, OccupiedError, VacantEntry};
26-
2727
use Entry::*;
2828

2929
/// Minimum number of elements in a node that is not a root.

alloc/src/collections/btree/map/entry.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@ use core::fmt::{self, Debug};
22
use core::marker::PhantomData;
33
use core::mem;
44

5-
use crate::alloc::{Allocator, Global};
5+
use Entry::*;
66

77
use super::super::borrow::DormantMutRef;
88
use super::super::node::{marker, Handle, NodeRef};
99
use super::BTreeMap;
10-
11-
use Entry::*;
10+
use crate::alloc::{Allocator, Global};
1211

1312
/// A view into a single entry in a map, which may either be vacant or occupied.
1413
///

alloc/src/collections/btree/map/tests.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
use core::assert_matches::assert_matches;
2+
use std::iter;
3+
use std::ops::Bound::{Excluded, Included, Unbounded};
4+
use std::panic::{catch_unwind, AssertUnwindSafe};
5+
use std::sync::atomic::AtomicUsize;
6+
use std::sync::atomic::Ordering::SeqCst;
7+
18
use super::*;
29
use crate::boxed::Box;
310
use crate::fmt::Debug;
@@ -6,11 +13,6 @@ use crate::string::{String, ToString};
613
use crate::testing::crash_test::{CrashTestDummy, Panic};
714
use crate::testing::ord_chaos::{Cyclic3, Governed, Governor};
815
use crate::testing::rng::DeterministicRng;
9-
use core::assert_matches::assert_matches;
10-
use std::iter;
11-
use std::ops::Bound::{Excluded, Included, Unbounded};
12-
use std::panic::{catch_unwind, AssertUnwindSafe};
13-
use std::sync::atomic::{AtomicUsize, Ordering::SeqCst};
1416

1517
// Minimum number of elements to insert, to guarantee a tree with 2 levels,
1618
// i.e., a tree who's root is an internal node at height 1, with edges to leaf nodes.

alloc/src/collections/btree/mem.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
use core::intrinsics;
2-
use core::mem;
3-
use core::ptr;
1+
use core::{intrinsics, mem, ptr};
42

53
/// This replaces the value behind the `v` unique reference by calling the
64
/// relevant function.

alloc/src/collections/btree/navigate.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
use core::borrow::Borrow;
2-
use core::hint;
32
use core::ops::RangeBounds;
4-
use core::ptr;
3+
use core::{hint, ptr};
54

6-
use super::node::{marker, ForceResult::*, Handle, NodeRef};
5+
use super::node::ForceResult::*;
6+
use super::node::{marker, Handle, NodeRef};
77
use super::search::SearchBound;
8-
98
use crate::alloc::Allocator;
109
// `front` and `back` are always both `None` or both `Some`.
1110
pub struct LeafRange<BorrowType, K, V> {

alloc/src/collections/btree/remove.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
use super::map::MIN_LEN;
2-
use super::node::{marker, ForceResult::*, Handle, LeftOrRight::*, NodeRef};
31
use core::alloc::Allocator;
42

3+
use super::map::MIN_LEN;
4+
use super::node::ForceResult::*;
5+
use super::node::LeftOrRight::*;
6+
use super::node::{marker, Handle, NodeRef};
7+
58
impl<'a, K: 'a, V: 'a> Handle<NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInternal>, marker::KV> {
69
/// Removes a key-value pair from the tree, and returns that pair, as well as
710
/// the leaf edge corresponding to that former pair. It's possible this empties

alloc/src/collections/btree/search.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ use core::borrow::Borrow;
22
use core::cmp::Ordering;
33
use core::ops::{Bound, RangeBounds};
44

5-
use super::node::{marker, ForceResult::*, Handle, NodeRef};
6-
75
use SearchBound::*;
86
use SearchResult::*;
97

8+
use super::node::ForceResult::*;
9+
use super::node::{marker, Handle, NodeRef};
10+
1011
pub enum SearchBound<T> {
1112
/// An inclusive bound to look for, just like `Bound::Included(T)`.
1213
Included(T),

alloc/src/collections/btree/set.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use crate::vec::Vec;
21
use core::borrow::Borrow;
32
use core::cmp::Ordering::{self, Equal, Greater, Less};
43
use core::cmp::{max, min};
@@ -12,8 +11,8 @@ use super::map::{BTreeMap, Keys};
1211
use super::merge_iter::MergeIterInner;
1312
use super::set_val::SetValZST;
1413
use super::Recover;
15-
1614
use crate::alloc::{Allocator, Global};
15+
use crate::vec::Vec;
1716

1817
/// An ordered set based on a B-Tree.
1918
///

alloc/src/collections/btree/set/tests.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
use std::ops::Bound::{Excluded, Included};
2+
use std::panic::{catch_unwind, AssertUnwindSafe};
3+
14
use super::*;
25
use crate::testing::crash_test::{CrashTestDummy, Panic};
36
use crate::testing::rng::DeterministicRng;
4-
use std::ops::Bound::{Excluded, Included};
5-
use std::panic::{catch_unwind, AssertUnwindSafe};
67

78
#[test]
89
fn test_clone_eq() {

alloc/src/collections/btree/split.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
use super::node::{ForceResult::*, Root};
2-
use super::search::SearchResult::*;
31
use core::alloc::Allocator;
42
use core::borrow::Borrow;
53

4+
use super::node::ForceResult::*;
5+
use super::node::Root;
6+
use super::search::SearchResult::*;
7+
68
impl<K, V> Root<K, V> {
79
/// Calculates the length of both trees that result from splitting up
810
/// a given number of distinct key-value pairs.

0 commit comments

Comments
 (0)