Skip to content

Commit 780a917

Browse files
committed
Run rustfmt on tests/codegen-units/.
1 parent 72800d3 commit 780a917

32 files changed

+208
-229
lines changed

rustfmt.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ ignore = [
1515
# - some UI tests are broken by different formatting
1616
# - some require special comments in a particular position (e.g. `EMIT_MIR` comments)
1717
"/tests/codegen/simd-intrinsic/", # Many types like `u8x64` are better hand-formatted.
18-
"/tests/codegen-units/",
1918
"/tests/coverage/",
2019
"/tests/coverage-run-rustdoc/",
2120
"/tests/crashes/",

tests/codegen-units/item-collection/auxiliary/cgu_export_trait_method.rs

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,43 @@
22

33
#![crate_type = "lib"]
44

5-
pub trait Trait : Sized {
5+
pub trait Trait: Sized {
66
fn without_self() -> u32;
7-
fn without_self_default() -> u32 { 0 }
7+
fn without_self_default() -> u32 {
8+
0
9+
}
810

9-
fn with_default_impl(self) -> Self { self }
10-
fn with_default_impl_generic<T>(self, x: T) -> (Self, T) { (self, x) }
11+
fn with_default_impl(self) -> Self {
12+
self
13+
}
14+
fn with_default_impl_generic<T>(self, x: T) -> (Self, T) {
15+
(self, x)
16+
}
1117

1218
fn without_default_impl(x: u32) -> (Self, u32);
1319
fn without_default_impl_generic<T>(x: T) -> (Self, T);
1420
}
1521

1622
impl Trait for char {
17-
fn without_self() -> u32 { 2 }
18-
fn without_default_impl(x: u32) -> (Self, u32) { ('c', x) }
19-
fn without_default_impl_generic<T>(x: T) -> (Self, T) { ('c', x) }
23+
fn without_self() -> u32 {
24+
2
25+
}
26+
fn without_default_impl(x: u32) -> (Self, u32) {
27+
('c', x)
28+
}
29+
fn without_default_impl_generic<T>(x: T) -> (Self, T) {
30+
('c', x)
31+
}
2032
}
2133

2234
impl Trait for u32 {
23-
fn without_self() -> u32 { 1 }
24-
fn without_default_impl(x: u32) -> (Self, u32) { (0, x) }
25-
fn without_default_impl_generic<T>(x: T) -> (Self, T) { (0, x) }
35+
fn without_self() -> u32 {
36+
1
37+
}
38+
fn without_default_impl(x: u32) -> (Self, u32) {
39+
(0, x)
40+
}
41+
fn without_default_impl_generic<T>(x: T) -> (Self, T) {
42+
(0, x)
43+
}
2644
}

tests/codegen-units/item-collection/auxiliary/cgu_extern_closures.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,19 @@
22

33
#[inline]
44
pub fn inlined_fn(x: i32, y: i32) -> i32 {
5-
6-
let closure = |a, b| { a + b };
5+
let closure = |a, b| a + b;
76

87
closure(x, y)
98
}
109

1110
pub fn inlined_fn_generic<T>(x: i32, y: i32, z: T) -> (i32, T) {
12-
13-
let closure = |a, b| { a + b };
11+
let closure = |a, b| a + b;
1412

1513
(closure(x, y), z)
1614
}
1715

1816
pub fn non_inlined_fn(x: i32, y: i32) -> i32 {
19-
20-
let closure = |a, b| { a + b };
17+
let closure = |a, b| a + b;
2118

2219
closure(x, y)
2320
}

tests/codegen-units/item-collection/cross-crate-closures.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ extern crate cgu_extern_closures;
1414
//~ MONO_ITEM fn cross_crate_closures::start[0]
1515
#[start]
1616
fn start(_: isize, _: *const *const u8) -> isize {
17-
1817
//~ MONO_ITEM fn cgu_extern_closures::inlined_fn[0]
1918
//~ MONO_ITEM fn cgu_extern_closures::inlined_fn[0]::{{closure}}[0]
2019
let _ = cgu_extern_closures::inlined_fn(1, 2);

tests/codegen-units/item-collection/cross-crate-trait-method.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ fn start(_: isize, _: *const *const u8) -> isize {
2424
//~ MONO_ITEM fn <char as cgu_export_trait_method::Trait>::with_default_impl
2525
let _ = Trait::with_default_impl('c');
2626

27-
28-
2927
//~ MONO_ITEM fn <u32 as cgu_export_trait_method::Trait>::with_default_impl_generic::<&str>
3028
let _ = Trait::with_default_impl_generic(0u32, "abc");
3129
//~ MONO_ITEM fn <u32 as cgu_export_trait_method::Trait>::with_default_impl_generic::<bool>

tests/codegen-units/item-collection/drop_in_place_intrinsic.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ impl Drop for StructWithDtor {
1515
//~ MONO_ITEM fn start
1616
#[start]
1717
fn start(_: isize, _: *const *const u8) -> isize {
18-
1918
//~ MONO_ITEM fn std::ptr::drop_in_place::<[StructWithDtor; 2]> - shim(Some([StructWithDtor; 2])) @@ drop_in_place_intrinsic-cgu.0[Internal]
2019
let x = [StructWithDtor(0), StructWithDtor(1)];
2120

tests/codegen-units/item-collection/function-as-argument.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ fn take_fn_pointer<T1, T2>(f: fn(T1, T2), x: T1, y: T2) {
1616
//~ MONO_ITEM fn start
1717
#[start]
1818
fn start(_: isize, _: *const *const u8) -> isize {
19-
2019
//~ MONO_ITEM fn take_fn_once::<u32, &str, fn(u32, &str) {function::<u32, &str>}>
2120
//~ MONO_ITEM fn function::<u32, &str>
2221
//~ MONO_ITEM fn <fn(u32, &str) {function::<u32, &str>} as std::ops::FnOnce<(u32, &str)>>::call_once - shim(fn(u32, &str) {function::<u32, &str>})

tests/codegen-units/item-collection/generic-drop-glue.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ struct StructNoDrop<T1, T2> {
2121

2222
enum EnumWithDrop<T1, T2> {
2323
A(T1),
24-
B(T2)
24+
B(T2),
2525
}
2626

2727
impl<T1, T2> Drop for EnumWithDrop<T1, T2> {
@@ -30,10 +30,9 @@ impl<T1, T2> Drop for EnumWithDrop<T1, T2> {
3030

3131
enum EnumNoDrop<T1, T2> {
3232
A(T1),
33-
B(T2)
33+
B(T2),
3434
}
3535

36-
3736
struct NonGenericNoDrop(#[allow(dead_code)] i32);
3837

3938
struct NonGenericWithDrop(#[allow(dead_code)] i32);
@@ -67,24 +66,24 @@ fn start(_: isize, _: *const *const u8) -> isize {
6766
//~ MONO_ITEM fn <EnumWithDrop<i32, i64> as std::ops::Drop>::drop
6867
let _ = match EnumWithDrop::A::<i32, i64>(0) {
6968
EnumWithDrop::A(x) => x,
70-
EnumWithDrop::B(x) => x as i32
69+
EnumWithDrop::B(x) => x as i32,
7170
};
7271

7372
//~ MONO_ITEM fn std::ptr::drop_in_place::<EnumWithDrop<f64, f32>> - shim(Some(EnumWithDrop<f64, f32>)) @@ generic_drop_glue-cgu.0[Internal]
7473
//~ MONO_ITEM fn <EnumWithDrop<f64, f32> as std::ops::Drop>::drop
7574
let _ = match EnumWithDrop::B::<f64, f32>(1.0) {
7675
EnumWithDrop::A(x) => x,
77-
EnumWithDrop::B(x) => x as f64
76+
EnumWithDrop::B(x) => x as f64,
7877
};
7978

8079
let _ = match EnumNoDrop::A::<i32, i64>(0) {
8180
EnumNoDrop::A(x) => x,
82-
EnumNoDrop::B(x) => x as i32
81+
EnumNoDrop::B(x) => x as i32,
8382
};
8483

8584
let _ = match EnumNoDrop::B::<f64, f32>(1.0) {
8685
EnumNoDrop::A(x) => x,
87-
EnumNoDrop::B(x) => x as f64
86+
EnumNoDrop::B(x) => x as f64,
8887
};
8988

9089
0

tests/codegen-units/item-collection/generic-impl.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,13 @@ struct Struct<T> {
88
f: fn(x: T) -> T,
99
}
1010

11-
fn id<T>(x: T) -> T { x }
11+
fn id<T>(x: T) -> T {
12+
x
13+
}
1214

1315
impl<T> Struct<T> {
14-
1516
fn new(x: T) -> Struct<T> {
16-
Struct {
17-
x: x,
18-
f: id
19-
}
17+
Struct { x: x, f: id }
2018
}
2119

2220
fn get<T2>(self, x: T2) -> (T, T2) {
@@ -25,11 +23,10 @@ impl<T> Struct<T> {
2523
}
2624

2725
pub struct LifeTimeOnly<'a> {
28-
_a: &'a u32
26+
_a: &'a u32,
2927
}
3028

3129
impl<'a> LifeTimeOnly<'a> {
32-
3330
//~ MONO_ITEM fn LifeTimeOnly::<'_>::foo
3431
pub fn foo(&self) {}
3532
//~ MONO_ITEM fn LifeTimeOnly::<'_>::bar

tests/codegen-units/item-collection/instantiation-through-vtable.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ trait Trait {
1010
}
1111

1212
struct Struct<T> {
13-
_a: T
13+
_a: T,
1414
}
1515

1616
impl<T> Trait for Struct<T> {
17-
fn foo(&self) -> u32 { 0 }
17+
fn foo(&self) -> u32 {
18+
0
19+
}
1820
fn bar(&self) {}
1921
}
2022

0 commit comments

Comments
 (0)