Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit e5d7f1b

Browse files
authored
Rollup merge of rust-lang#125693 - Zalathar:format, r=lqd
Format all source files in `tests/coverage/` Currently we can't automatically enforce formatting on tests (see rust-lang#125637), but we can at least keep things relatively tidy by occasionally running the formatter manually. This was done by temporarily commenting out the `"/tests/"` exclusion in `rustfmt.toml`, and then running: - `x fmt tests/coverage` - `x test coverage --bless` (This PR also includes a few cosmetic tweaks to some of the affected files, to convince rustfmt to format them in the way we want.) `@rustbot` label +A-code-coverage
2 parents 014e4f3 + 9dc6e08 commit e5d7f1b

23 files changed

+88
-102
lines changed

tests/coverage/auxiliary/used_crate.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,23 @@ pub fn used_function() {
1717
}
1818

1919
pub fn used_only_from_bin_crate_generic_function<T: Debug>(arg: T) {
20-
println!("used_only_from_bin_crate_generic_function with {:?}", arg);
20+
println!("used_only_from_bin_crate_generic_function with {arg:?}");
2121
}
2222
// Expect for above function: `Unexecuted instantiation` (see below)
2323
pub fn used_only_from_this_lib_crate_generic_function<T: Debug>(arg: T) {
24-
println!("used_only_from_this_lib_crate_generic_function with {:?}", arg);
24+
println!("used_only_from_this_lib_crate_generic_function with {arg:?}");
2525
}
2626

2727
pub fn used_from_bin_crate_and_lib_crate_generic_function<T: Debug>(arg: T) {
28-
println!("used_from_bin_crate_and_lib_crate_generic_function with {:?}", arg);
28+
println!("used_from_bin_crate_and_lib_crate_generic_function with {arg:?}");
2929
}
3030

3131
pub fn used_with_same_type_from_bin_crate_and_lib_crate_generic_function<T: Debug>(arg: T) {
32-
println!("used_with_same_type_from_bin_crate_and_lib_crate_generic_function with {:?}", arg);
32+
println!("used_with_same_type_from_bin_crate_and_lib_crate_generic_function with {arg:?}");
3333
}
3434

3535
pub fn unused_generic_function<T: Debug>(arg: T) {
36-
println!("unused_generic_function with {:?}", arg);
36+
println!("unused_generic_function with {arg:?}");
3737
}
3838

3939
pub fn unused_function() {

tests/coverage/auxiliary/used_inline_crate.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,28 +31,28 @@ pub fn used_inline_function() {
3131

3232
#[inline(always)]
3333
pub fn used_only_from_bin_crate_generic_function<T: Debug>(arg: T) {
34-
println!("used_only_from_bin_crate_generic_function with {:?}", arg);
34+
println!("used_only_from_bin_crate_generic_function with {arg:?}");
3535
}
3636
// Expect for above function: `Unexecuted instantiation` (see notes in `used_crate.rs`)
3737

3838
#[inline(always)]
3939
pub fn used_only_from_this_lib_crate_generic_function<T: Debug>(arg: T) {
40-
println!("used_only_from_this_lib_crate_generic_function with {:?}", arg);
40+
println!("used_only_from_this_lib_crate_generic_function with {arg:?}");
4141
}
4242

4343
#[inline(always)]
4444
pub fn used_from_bin_crate_and_lib_crate_generic_function<T: Debug>(arg: T) {
45-
println!("used_from_bin_crate_and_lib_crate_generic_function with {:?}", arg);
45+
println!("used_from_bin_crate_and_lib_crate_generic_function with {arg:?}");
4646
}
4747

4848
#[inline(always)]
4949
pub fn used_with_same_type_from_bin_crate_and_lib_crate_generic_function<T: Debug>(arg: T) {
50-
println!("used_with_same_type_from_bin_crate_and_lib_crate_generic_function with {:?}", arg);
50+
println!("used_with_same_type_from_bin_crate_and_lib_crate_generic_function with {arg:?}");
5151
}
5252

5353
#[inline(always)]
5454
pub fn unused_generic_function<T: Debug>(arg: T) {
55-
println!("unused_generic_function with {:?}", arg);
55+
println!("unused_generic_function with {arg:?}");
5656
}
5757

5858
#[inline(always)]

tests/coverage/coroutine.cov-map

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Number of file 0 mappings: 4
1212
- Code(Counter(0)) at (prev + 2, 1) to (start + 0, 2)
1313

1414
Function name: coroutine::main
15-
Raw bytes (65): 0x[01, 01, 08, 07, 0d, 05, 09, 11, 15, 1e, 19, 11, 15, 15, 19, 1e, 19, 11, 15, 09, 01, 13, 01, 02, 16, 01, 07, 0b, 00, 2e, 11, 01, 2b, 00, 2d, 03, 01, 0e, 00, 35, 11, 02, 0b, 00, 2e, 1e, 01, 22, 00, 27, 1a, 00, 2c, 00, 2e, 17, 01, 0e, 00, 35, 1a, 02, 01, 00, 02]
15+
Raw bytes (65): 0x[01, 01, 08, 07, 0d, 05, 09, 11, 15, 1e, 19, 11, 15, 15, 19, 1e, 19, 11, 15, 09, 01, 13, 01, 02, 16, 01, 08, 0b, 00, 2e, 11, 01, 2b, 00, 2d, 03, 01, 0e, 00, 35, 11, 02, 0b, 00, 2e, 1e, 01, 22, 00, 27, 1a, 00, 2c, 00, 2e, 17, 01, 0e, 00, 35, 1a, 02, 01, 00, 02]
1616
Number of files: 1
1717
- file 0 => global file 1
1818
Number of expressions: 8
@@ -26,7 +26,7 @@ Number of expressions: 8
2626
- expression 7 operands: lhs = Counter(4), rhs = Counter(5)
2727
Number of file 0 mappings: 9
2828
- Code(Counter(0)) at (prev + 19, 1) to (start + 2, 22)
29-
- Code(Counter(0)) at (prev + 7, 11) to (start + 0, 46)
29+
- Code(Counter(0)) at (prev + 8, 11) to (start + 0, 46)
3030
- Code(Counter(4)) at (prev + 1, 43) to (start + 0, 45)
3131
- Code(Expression(0, Add)) at (prev + 1, 14) to (start + 0, 53)
3232
= ((c1 + c2) + c3)
@@ -41,11 +41,11 @@ Number of file 0 mappings: 9
4141
= ((c4 - c5) - c6)
4242

4343
Function name: coroutine::main::{closure#0}
44-
Raw bytes (14): 0x[01, 01, 00, 02, 01, 15, 29, 01, 1f, 05, 02, 10, 01, 06]
44+
Raw bytes (14): 0x[01, 01, 00, 02, 01, 16, 08, 01, 1f, 05, 02, 10, 01, 06]
4545
Number of files: 1
4646
- file 0 => global file 1
4747
Number of expressions: 0
4848
Number of file 0 mappings: 2
49-
- Code(Counter(0)) at (prev + 21, 41) to (start + 1, 31)
49+
- Code(Counter(0)) at (prev + 22, 8) to (start + 1, 31)
5050
- Code(Counter(1)) at (prev + 2, 16) to (start + 1, 6)
5151

tests/coverage/coroutine.coverage

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,16 @@
1010
LL| |// to handle this condition, and still report dead block coverage.
1111
LL| 1|fn get_u32(val: bool) -> Result<u32, String> {
1212
LL| 1| if val {
13-
LL| 1| Ok(1)
13+
LL| 1| Ok(1) //
1414
LL| | } else {
15-
LL| 0| Err(String::from("some error"))
15+
LL| 0| Err(String::from("some error")) //
1616
LL| | }
1717
LL| 1|}
1818
LL| |
1919
LL| 1|fn main() {
2020
LL| 1| let is_true = std::env::args().len() == 1;
21-
LL| 1| let mut coroutine = #[coroutine] || {
21+
LL| 1| let mut coroutine = #[coroutine]
22+
LL| 1| || {
2223
LL| 1| yield get_u32(is_true);
2324
LL| 1| return "foo";
2425
LL| 1| };

tests/coverage/coroutine.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,16 @@ use std::pin::Pin;
1010
// to handle this condition, and still report dead block coverage.
1111
fn get_u32(val: bool) -> Result<u32, String> {
1212
if val {
13-
Ok(1)
13+
Ok(1) //
1414
} else {
15-
Err(String::from("some error"))
15+
Err(String::from("some error")) //
1616
}
1717
}
1818

1919
fn main() {
2020
let is_true = std::env::args().len() == 1;
21-
let mut coroutine = #[coroutine] || {
21+
let mut coroutine = #[coroutine]
22+
|| {
2223
yield get_u32(is_true);
2324
return "foo";
2425
};

tests/coverage/inline-dead.coverage

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
LL| |#[inline]
1515
LL| 1|fn live<const B: bool>() -> u32 {
1616
LL| 1| if B {
17-
LL| 0| dead()
17+
LL| 0| dead() //
1818
LL| | } else {
1919
LL| 1| 0
2020
LL| | }

tests/coverage/inline-dead.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ fn main() {
1313
#[inline]
1414
fn live<const B: bool>() -> u32 {
1515
if B {
16-
dead()
16+
dead() //
1717
} else {
1818
0
1919
}

tests/coverage/inner_items.coverage

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
^0
5353
LL| |
5454
LL| 1| let mut val = InStruct {
55-
LL| 1| in_struct_field: 101,
55+
LL| 1| in_struct_field: 101, //
5656
LL| 1| };
5757
LL| 1|
5858
LL| 1| val.default_trait_func();

tests/coverage/inner_items.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ fn main() {
5050
}
5151

5252
let mut val = InStruct {
53-
in_struct_field: 101,
53+
in_struct_field: 101, //
5454
};
5555

5656
val.default_trait_func();

tests/coverage/let_else_loop.cov-map

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
Function name: let_else_loop::_if (unused)
2-
Raw bytes (19): 0x[01, 01, 00, 03, 00, 16, 01, 01, 0c, 00, 02, 09, 00, 10, 00, 02, 09, 00, 10]
2+
Raw bytes (19): 0x[01, 01, 00, 03, 00, 16, 01, 01, 0c, 00, 01, 0f, 00, 16, 00, 00, 20, 00, 27]
33
Number of files: 1
44
- file 0 => global file 1
55
Number of expressions: 0
66
Number of file 0 mappings: 3
77
- Code(Zero) at (prev + 22, 1) to (start + 1, 12)
8-
- Code(Zero) at (prev + 2, 9) to (start + 0, 16)
9-
- Code(Zero) at (prev + 2, 9) to (start + 0, 16)
8+
- Code(Zero) at (prev + 1, 15) to (start + 0, 22)
9+
- Code(Zero) at (prev + 0, 32) to (start + 0, 39)
1010

1111
Function name: let_else_loop::_loop_either_way (unused)
1212
Raw bytes (19): 0x[01, 01, 00, 03, 00, 0f, 01, 01, 14, 00, 01, 1c, 00, 23, 00, 01, 05, 00, 0c]

0 commit comments

Comments
 (0)