Skip to content

Commit 95e59b9

Browse files
committed
apply fmt
1 parent 1a9025e commit 95e59b9

File tree

18 files changed

+116
-89
lines changed

18 files changed

+116
-89
lines changed

alloc/tests/autotraits.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,7 @@ fn test_btree_map() {
5555

5656
require_send_sync(async {
5757
let _v = None::<
58-
alloc::collections::btree_map::ExtractIf<
59-
'_,
60-
&u32,
61-
&u32,
62-
fn(&&u32, &mut &u32) -> bool,
63-
>,
58+
alloc::collections::btree_map::ExtractIf<'_, &u32, &u32, fn(&&u32, &mut &u32) -> bool>,
6459
>;
6560
async {}.await;
6661
});

alloc/tests/vec.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use core::alloc::{Allocator, Layout};
2-
use core::{assert_eq, assert_ne};
32
use core::num::NonZeroUsize;
43
use core::ptr::NonNull;
4+
use core::{assert_eq, assert_ne};
55
use std::alloc::System;
66
use std::assert_matches::assert_matches;
77
use std::borrow::Cow;
@@ -1212,7 +1212,7 @@ fn test_in_place_specialization_step_up_down() {
12121212
assert_eq!(sink.len(), 2);
12131213

12141214
let mut src: Vec<[u8; 3]> = Vec::with_capacity(17);
1215-
src.resize( 8, [0; 3]);
1215+
src.resize(8, [0; 3]);
12161216
let iter = src.into_iter().map(|[a, b, _]| [a, b]);
12171217
assert_in_place_trait(&iter);
12181218
let sink: Vec<[u8; 2]> = iter.collect();
@@ -1221,11 +1221,7 @@ fn test_in_place_specialization_step_up_down() {
12211221

12221222
let src = vec![[0u8; 4]; 256];
12231223
let srcptr = src.as_ptr();
1224-
let iter = src
1225-
.into_iter()
1226-
.flat_map(|a| {
1227-
a.into_iter().map(|b| b.wrapping_add(1))
1228-
});
1224+
let iter = src.into_iter().flat_map(|a| a.into_iter().map(|b| b.wrapping_add(1)));
12291225
assert_in_place_trait(&iter);
12301226
let sink = iter.collect::<Vec<_>>();
12311227
assert_eq!(srcptr as *const u8, sink.as_ptr());

core/tests/array.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use core::{array, assert_eq};
21
use core::num::NonZeroUsize;
32
use core::sync::atomic::{AtomicUsize, Ordering};
3+
use core::{array, assert_eq};
44

55
#[test]
66
fn array_from_ref() {

core/tests/cell.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -466,14 +466,14 @@ fn const_cells() {
466466
const CELL: Cell<i32> = Cell::new(3);
467467
const _: i32 = CELL.into_inner();
468468

469-
/* FIXME(#110395)
470-
const UNSAFE_CELL_FROM: UnsafeCell<i32> = UnsafeCell::from(3);
471-
const _: i32 = UNSAFE_CELL.into_inner();
469+
/* FIXME(#110395)
470+
const UNSAFE_CELL_FROM: UnsafeCell<i32> = UnsafeCell::from(3);
471+
const _: i32 = UNSAFE_CELL.into_inner();
472472
473-
const REF_CELL_FROM: RefCell<i32> = RefCell::from(3);
474-
const _: i32 = REF_CELL.into_inner();
473+
const REF_CELL_FROM: RefCell<i32> = RefCell::from(3);
474+
const _: i32 = REF_CELL.into_inner();
475475
476-
const CELL_FROM: Cell<i32> = Cell::from(3);
477-
const _: i32 = CELL.into_inner();
478-
*/
476+
const CELL_FROM: Cell<i32> = Cell::from(3);
477+
const _: i32 = CELL.into_inner();
478+
*/
479479
}

core/tests/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use core::error::{request_value, request_ref, Request};
1+
use core::error::{request_ref, request_value, Request};
22

33
// Test the `Request` API.
44
#[derive(Debug)]

core/tests/fmt/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ fn test_pointer_formats_data_pointer() {
2222
#[test]
2323
fn test_estimated_capacity() {
2424
assert_eq!(format_args!("").estimated_capacity(), 0);
25-
assert_eq!(format_args!("{}", {""}).estimated_capacity(), 0);
25+
assert_eq!(format_args!("{}", { "" }).estimated_capacity(), 0);
2626
assert_eq!(format_args!("Hello").estimated_capacity(), 5);
27-
assert_eq!(format_args!("Hello, {}!", {""}).estimated_capacity(), 16);
28-
assert_eq!(format_args!("{}, hello!", {"World"}).estimated_capacity(), 0);
29-
assert_eq!(format_args!("{}. 16-bytes piece", {"World"}).estimated_capacity(), 32);
27+
assert_eq!(format_args!("Hello, {}!", { "" }).estimated_capacity(), 16);
28+
assert_eq!(format_args!("{}, hello!", { "World" }).estimated_capacity(), 0);
29+
assert_eq!(format_args!("{}. 16-bytes piece", { "World" }).estimated_capacity(), 32);
3030
}
3131

3232
#[test]

core/tests/hash/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ impl Hasher for MyHasher {
3535
#[test]
3636
fn test_writer_hasher() {
3737
// FIXME(#110395)
38-
/* const */ fn hash<T: Hash>(t: &T) -> u64 {
38+
/* const */
39+
fn hash<T: Hash>(t: &T) -> u64 {
3940
let mut s = MyHasher { hash: 0 };
4041
t.hash(&mut s);
4142
s.finish()
@@ -140,7 +141,8 @@ impl Hash for Custom {
140141
#[test]
141142
fn test_custom_state() {
142143
// FIXME(#110395)
143-
/* const */ fn hash<T: Hash>(t: &T) -> u64 {
144+
/* const */
145+
fn hash<T: Hash>(t: &T) -> u64 {
144146
let mut c = CustomHasher { output: 0 };
145147
t.hash(&mut c);
146148
c.finish()

core/tests/iter/adapters/chain.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ fn test_iterator_chain_advance_by() {
4242
let mut iter = Unfuse::new(xs).chain(Unfuse::new(ys));
4343
assert_eq!(iter.advance_by(xs.len() + i), Ok(()));
4444
assert_eq!(iter.next(), Some(&ys[i]));
45-
assert_eq!(iter.advance_by(100), Err(NonZeroUsize::new(100 - (ys.len() - i - 1)).unwrap()));
45+
assert_eq!(
46+
iter.advance_by(100),
47+
Err(NonZeroUsize::new(100 - (ys.len() - i - 1)).unwrap())
48+
);
4649
assert_eq!(iter.advance_by(0), Ok(()));
4750
}
4851

@@ -71,15 +74,21 @@ fn test_iterator_chain_advance_back_by() {
7174
let mut iter = Unfuse::new(xs).chain(Unfuse::new(ys));
7275
assert_eq!(iter.advance_back_by(i), Ok(()));
7376
assert_eq!(iter.next_back(), Some(&ys[ys.len() - i - 1]));
74-
assert_eq!(iter.advance_back_by(100), Err(NonZeroUsize::new(100 - (len - i - 1)).unwrap()));
77+
assert_eq!(
78+
iter.advance_back_by(100),
79+
Err(NonZeroUsize::new(100 - (len - i - 1)).unwrap())
80+
);
7581
assert_eq!(iter.advance_back_by(0), Ok(()));
7682
}
7783

7884
for i in 0..xs.len() {
7985
let mut iter = Unfuse::new(xs).chain(Unfuse::new(ys));
8086
assert_eq!(iter.advance_back_by(ys.len() + i), Ok(()));
8187
assert_eq!(iter.next_back(), Some(&xs[xs.len() - i - 1]));
82-
assert_eq!(iter.advance_back_by(100), Err(NonZeroUsize::new(100 - (xs.len() - i - 1)).unwrap()));
88+
assert_eq!(
89+
iter.advance_back_by(100),
90+
Err(NonZeroUsize::new(100 - (xs.len() - i - 1)).unwrap())
91+
);
8392
assert_eq!(iter.advance_back_by(0), Ok(()));
8493
}
8594

core/tests/iter/adapters/flatten.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use core::assert_eq;
21
use super::*;
2+
use core::assert_eq;
33
use core::iter::*;
44
use core::num::NonZeroUsize;
55

core/tests/iter/adapters/step_by.rs

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,6 @@ fn test_step_by_skip() {
245245
assert_eq!((200..=255u8).step_by(10).nth(3), Some(230));
246246
}
247247

248-
249248
struct DeOpt<I: Iterator>(I);
250249

251250
impl<I: Iterator> Iterator for DeOpt<I> {
@@ -265,17 +264,15 @@ impl<I: DoubleEndedIterator> DoubleEndedIterator for DeOpt<I> {
265264
#[test]
266265
fn test_step_by_fold_range_specialization() {
267266
macro_rules! t {
268-
($range:expr, $var: ident, $body:tt) => {
269-
{
270-
// run the same tests for the non-optimized version
271-
let mut $var = DeOpt($range);
272-
$body
273-
}
274-
{
275-
let mut $var = $range;
276-
$body
277-
}
267+
($range:expr, $var: ident, $body:tt) => {{
268+
// run the same tests for the non-optimized version
269+
let mut $var = DeOpt($range);
270+
$body
278271
}
272+
{
273+
let mut $var = $range;
274+
$body
275+
}};
279276
}
280277

281278
t!((1usize..5).step_by(1), r, {
@@ -288,13 +285,12 @@ fn test_step_by_fold_range_specialization() {
288285
assert_eq!(r.sum::<usize>(), 2);
289286
});
290287

291-
292288
t!((0usize..5).step_by(2), r, {
293289
assert_eq!(r.next(), Some(0));
294290
assert_eq!(r.sum::<usize>(), 6);
295291
});
296292

297-
t!((usize::MAX - 6 .. usize::MAX).step_by(5), r, {
293+
t!((usize::MAX - 6..usize::MAX).step_by(5), r, {
298294
assert_eq!(r.next(), Some(usize::MAX - 6));
299295
assert_eq!(r.sum::<usize>(), usize::MAX - 1);
300296
});

0 commit comments

Comments
 (0)