Skip to content

Commit b3d15eb

Browse files
authored
Rollup merge of #119853 - klensy:rustfmt-ignore, r=cuviper
rustfmt.toml: don't ignore just any tests path, only root one Previously ignored any `tests` path, now only /tests at repo root. For reference, https://git-scm.com/docs/gitignore#_pattern_format
2 parents ca17ce4 + aa696c5 commit b3d15eb

File tree

22 files changed

+127
-96
lines changed

22 files changed

+127
-96
lines changed

compiler/rustc_errors/src/markdown/tests/term.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ use termcolor::{BufferWriter, ColorChoice};
55
use super::*;
66

77
const INPUT: &str = include_str!("input.md");
8-
const OUTPUT_PATH: &[&str] = &[env!("CARGO_MANIFEST_DIR"), "src","markdown","tests","output.stdout"];
8+
const OUTPUT_PATH: &[&str] =
9+
&[env!("CARGO_MANIFEST_DIR"), "src", "markdown", "tests", "output.stdout"];
910

1011
const TEST_WIDTH: usize = 80;
1112

@@ -34,7 +35,7 @@ quis dolor non venenatis. Aliquam ut. ";
3435
fn test_wrapping_write() {
3536
WIDTH.with(|w| w.set(TEST_WIDTH));
3637
let mut buf = BufWriter::new(Vec::new());
37-
let txt = TXT.replace("-\n","-").replace("_\n","_").replace('\n', " ").replace(" ", "");
38+
let txt = TXT.replace("-\n", "-").replace("_\n", "_").replace('\n', " ").replace(" ", "");
3839
write_wrapping(&mut buf, &txt, 0, None).unwrap();
3940
write_wrapping(&mut buf, &txt, 4, None).unwrap();
4041
write_wrapping(

library/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
});

library/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());

library/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() {

library/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
}

library/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)]

library/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]

library/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()

library/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

library/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

0 commit comments

Comments
 (0)