Skip to content

Commit

Permalink
Reformat using the new identifier sorting from rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Sep 22, 2024
1 parent b3d4fde commit a28cdff
Show file tree
Hide file tree
Showing 236 changed files with 622 additions and 654 deletions.
2 changes: 1 addition & 1 deletion alloc/benches/binary_heap.rs
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions alloc/benches/btree/map.rs
Original file line number Diff line number Diff line change
@@ -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) => {
Expand Down
4 changes: 2 additions & 2 deletions alloc/benches/slice.rs
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion alloc/benches/str.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use test::{black_box, Bencher};
use test::{Bencher, black_box};

#[bench]
fn char_iterator(b: &mut Bencher) {
Expand Down
2 changes: 1 addition & 1 deletion alloc/benches/string.rs
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion alloc/benches/vec.rs
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions alloc/benches/vec_deque.rs
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
7 changes: 5 additions & 2 deletions alloc/src/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion alloc/src/collections/binary_heap/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
2 changes: 1 addition & 1 deletion alloc/src/collections/binary_heap/tests.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::panic::{catch_unwind, AssertUnwindSafe};
use std::panic::{AssertUnwindSafe, catch_unwind};

use super::*;
use crate::boxed::Box;
Expand Down
2 changes: 1 addition & 1 deletion alloc/src/collections/btree/fix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions alloc/src/collections/btree/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion alloc/src/collections/btree/map/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
2 changes: 1 addition & 1 deletion alloc/src/collections/btree/map/tests.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
2 changes: 1 addition & 1 deletion alloc/src/collections/btree/navigate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
2 changes: 1 addition & 1 deletion alloc/src/collections/btree/remove.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion alloc/src/collections/btree/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)`.
Expand Down
2 changes: 1 addition & 1 deletion alloc/src/collections/btree/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
18 changes: 7 additions & 11 deletions alloc/src/collections/btree/set/tests.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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]
Expand Down
30 changes: 13 additions & 17 deletions alloc/src/collections/linked_list/tests.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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
]);
}

{
Expand All @@ -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
]);
}

{
Expand All @@ -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
]);
}

{
Expand Down
2 changes: 1 addition & 1 deletion alloc/src/collections/vec_deque/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
7 changes: 3 additions & 4 deletions alloc/src/collections/vec_deque/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion alloc/src/ffi/c_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
6 changes: 3 additions & 3 deletions alloc/src/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand All @@ -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")]
Expand Down
4 changes: 2 additions & 2 deletions alloc/src/rc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
16 changes: 8 additions & 8 deletions alloc/src/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand All @@ -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
Expand Down
Loading

0 comments on commit a28cdff

Please sign in to comment.