Skip to content

Commit 448d63e

Browse files
committed
Tweak various coverage test files for slightly nicer formatting
For coverage tests, splitting code across multiple lines often makes the resulting coverage report easier to interpret, so we force rustfmt to retain line breaks by adding dummy line comments with `//`.
1 parent da159eb commit 448d63e

15 files changed

+54
-58
lines changed

tests/coverage/auxiliary/used_crate.rs

+5-5
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

+5-5
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.coverage

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
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| |

tests/coverage/coroutine.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ 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

tests/coverage/inline-dead.coverage

+1-1
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

+1-1
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

+1-1
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

+1-1
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/partial_eq.coverage

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
LL| 1| "{:?} < {:?} = {}",
2727
LL| 1| version_3_2_1,
2828
LL| 1| version_3_3_0,
29-
LL| 1| version_3_2_1 < version_3_3_0
29+
LL| 1| version_3_2_1 < version_3_3_0, //
3030
LL| 1| );
3131
LL| 1|}
3232
LL| |

tests/coverage/partial_eq.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ fn main() {
2626
"{:?} < {:?} = {}",
2727
version_3_2_1,
2828
version_3_3_0,
29-
version_3_2_1 < version_3_3_0
29+
version_3_2_1 < version_3_3_0, //
3030
);
3131
}
3232

tests/coverage/try_error_result.cov-map

+6-6
Original file line numberDiff line numberDiff line change
@@ -25,26 +25,26 @@ Number of file 0 mappings: 4
2525
- Code(Counter(0)) at (prev + 2, 5) to (start + 0, 6)
2626

2727
Function name: try_error_result::call
28-
Raw bytes (26): 0x[01, 01, 01, 01, 05, 04, 01, 04, 01, 01, 14, 05, 02, 09, 00, 10, 02, 02, 09, 00, 0f, 01, 02, 01, 00, 02]
28+
Raw bytes (26): 0x[01, 01, 01, 01, 05, 04, 01, 05, 01, 01, 14, 05, 02, 09, 00, 10, 02, 02, 09, 00, 0f, 01, 02, 01, 00, 02]
2929
Number of files: 1
3030
- file 0 => global file 1
3131
Number of expressions: 1
3232
- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
3333
Number of file 0 mappings: 4
34-
- Code(Counter(0)) at (prev + 4, 1) to (start + 1, 20)
34+
- Code(Counter(0)) at (prev + 5, 1) to (start + 1, 20)
3535
- Code(Counter(1)) at (prev + 2, 9) to (start + 0, 16)
3636
- Code(Expression(0, Sub)) at (prev + 2, 9) to (start + 0, 15)
3737
= (c0 - c1)
3838
- Code(Counter(0)) at (prev + 2, 1) to (start + 0, 2)
3939

4040
Function name: try_error_result::main
41-
Raw bytes (26): 0x[01, 01, 01, 01, 05, 04, 01, 73, 01, 02, 0c, 05, 03, 05, 00, 06, 02, 02, 05, 00, 0b, 01, 01, 01, 00, 02]
41+
Raw bytes (26): 0x[01, 01, 01, 01, 05, 04, 01, 71, 01, 02, 0c, 05, 03, 05, 00, 06, 02, 02, 05, 00, 0b, 01, 01, 01, 00, 02]
4242
Number of files: 1
4343
- file 0 => global file 1
4444
Number of expressions: 1
4545
- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
4646
Number of file 0 mappings: 4
47-
- Code(Counter(0)) at (prev + 115, 1) to (start + 2, 12)
47+
- Code(Counter(0)) at (prev + 113, 1) to (start + 2, 12)
4848
- Code(Counter(1)) at (prev + 3, 5) to (start + 0, 6)
4949
- Code(Expression(0, Sub)) at (prev + 2, 5) to (start + 0, 11)
5050
= (c0 - c1)
@@ -81,7 +81,7 @@ Number of file 0 mappings: 11
8181
= (((c4 + Zero) + Zero) + c3)
8282

8383
Function name: try_error_result::test2
84-
Raw bytes (280): 0x[01, 01, 24, 01, 07, 00, 09, 03, 0d, 41, 00, 1e, 00, 41, 00, 1e, 00, 41, 00, 4a, 00, 4e, 00, 52, 41, 03, 0d, 52, 41, 03, 0d, 4e, 00, 52, 41, 03, 0d, 4a, 00, 4e, 00, 52, 41, 03, 0d, 66, 00, 45, 00, 45, 00, 66, 00, 45, 00, 7a, 00, 4d, 00, 4d, 00, 7a, 00, 4d, 00, 83, 01, 0d, 87, 01, 00, 00, 8b, 01, 8f, 01, 00, 19, 00, 28, 01, 3e, 01, 03, 17, 03, 08, 09, 00, 0e, 52, 02, 09, 04, 1a, 41, 06, 0d, 00, 2f, 00, 00, 2f, 00, 30, 1e, 00, 31, 03, 35, 00, 04, 11, 00, 12, 1a, 02, 11, 04, 12, 00, 05, 11, 00, 14, 1a, 00, 17, 00, 41, 19, 00, 41, 00, 42, 00, 00, 43, 00, 5f, 00, 00, 5f, 00, 60, 00, 01, 0d, 00, 20, 00, 01, 11, 00, 14, 00, 00, 17, 00, 41, 00, 00, 41, 00, 42, 00, 00, 43, 00, 60, 00, 00, 60, 00, 61, 00, 01, 0d, 00, 20, 46, 04, 11, 00, 14, 4e, 00, 17, 00, 42, 00, 00, 42, 00, 43, 4a, 00, 44, 00, 61, 00, 00, 61, 00, 62, 46, 01, 0d, 00, 20, 62, 01, 11, 00, 14, 45, 00, 17, 01, 36, 00, 01, 36, 00, 37, 66, 01, 12, 00, 2f, 00, 00, 2f, 00, 30, 62, 01, 0d, 00, 20, 76, 01, 11, 00, 14, 4d, 00, 17, 01, 36, 00, 02, 11, 00, 12, 7a, 01, 12, 00, 2f, 00, 01, 11, 00, 12, 76, 02, 0d, 00, 20, 0d, 03, 05, 00, 0b, 7f, 01, 01, 00, 02]
84+
Raw bytes (280): 0x[01, 01, 24, 01, 07, 00, 09, 03, 0d, 41, 00, 1e, 00, 41, 00, 1e, 00, 41, 00, 4a, 00, 4e, 00, 52, 41, 03, 0d, 52, 41, 03, 0d, 4e, 00, 52, 41, 03, 0d, 4a, 00, 4e, 00, 52, 41, 03, 0d, 66, 00, 45, 00, 45, 00, 66, 00, 45, 00, 7a, 00, 4d, 00, 4d, 00, 7a, 00, 4d, 00, 83, 01, 0d, 87, 01, 00, 00, 8b, 01, 8f, 01, 00, 19, 00, 28, 01, 3d, 01, 03, 17, 03, 08, 09, 00, 0e, 52, 02, 09, 04, 1a, 41, 06, 0d, 00, 2f, 00, 00, 2f, 00, 30, 1e, 00, 31, 03, 35, 00, 04, 11, 00, 12, 1a, 02, 11, 04, 12, 00, 05, 11, 00, 14, 1a, 00, 17, 00, 41, 19, 00, 41, 00, 42, 00, 00, 43, 00, 5f, 00, 00, 5f, 00, 60, 00, 01, 0d, 00, 20, 00, 01, 11, 00, 14, 00, 00, 17, 00, 41, 00, 00, 41, 00, 42, 00, 00, 43, 00, 60, 00, 00, 60, 00, 61, 00, 01, 0d, 00, 20, 46, 04, 11, 00, 14, 4e, 00, 17, 00, 42, 00, 00, 42, 00, 43, 4a, 00, 44, 00, 61, 00, 00, 61, 00, 62, 46, 01, 0d, 00, 20, 62, 01, 11, 00, 14, 45, 00, 17, 01, 36, 00, 01, 36, 00, 37, 66, 01, 12, 00, 2f, 00, 00, 2f, 00, 30, 62, 01, 0d, 00, 20, 76, 01, 11, 00, 14, 4d, 00, 17, 01, 36, 00, 02, 11, 00, 12, 7a, 01, 12, 00, 2f, 00, 01, 11, 00, 12, 76, 02, 0d, 00, 20, 0d, 03, 05, 00, 0b, 7f, 01, 01, 00, 02]
8585
Number of files: 1
8686
- file 0 => global file 1
8787
Number of expressions: 36
@@ -122,7 +122,7 @@ Number of expressions: 36
122122
- expression 34 operands: lhs = Expression(35, Add), rhs = Zero
123123
- expression 35 operands: lhs = Counter(6), rhs = Zero
124124
Number of file 0 mappings: 40
125-
- Code(Counter(0)) at (prev + 62, 1) to (start + 3, 23)
125+
- Code(Counter(0)) at (prev + 61, 1) to (start + 3, 23)
126126
- Code(Expression(0, Add)) at (prev + 8, 9) to (start + 0, 14)
127127
= (c0 + (Zero + c2))
128128
- Code(Expression(20, Sub)) at (prev + 2, 9) to (start + 4, 26)

tests/coverage/try_error_result.coverage

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
LL| |#![allow(unused_assignments)]
2+
LL| |#![cfg_attr(rustfmt, rustfmt::skip)]
23
LL| |//@ failure-status: 1
34
LL| |
45
LL| 6|fn call(return_error: bool) -> Result<(), ()> {
@@ -9,7 +10,6 @@
910
LL| | }
1011
LL| 6|}
1112
LL| |
12-
LL| |#[rustfmt::skip]
1313
LL| 1|fn test1() -> Result<(), ()> {
1414
LL| 1| let mut
1515
LL| 1| countdown = 10
@@ -59,7 +59,6 @@
5959
LL| 17| }
6060
LL| |}
6161
LL| |
62-
LL| |#[rustfmt::skip]
6362
LL| 1|fn test2() -> Result<(), ()> {
6463
LL| 1| let thing1 = Thing1{};
6564
LL| 1| let mut
@@ -117,7 +116,6 @@
117116
LL| 0| Ok(())
118117
LL| 1|}
119118
LL| |
120-
LL| |#[rustfmt::skip]
121119
LL| 1|fn main() -> Result<(), ()> {
122120
LL| 1| test1().expect_err("test1 should fail");
123121
LL| 1| test2()

tests/coverage/try_error_result.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![allow(unused_assignments)]
2+
#![cfg_attr(rustfmt, rustfmt::skip)]
23
//@ failure-status: 1
34

45
fn call(return_error: bool) -> Result<(), ()> {
@@ -9,7 +10,6 @@ fn call(return_error: bool) -> Result<(), ()> {
910
}
1011
}
1112

12-
#[rustfmt::skip]
1313
fn test1() -> Result<(), ()> {
1414
let mut
1515
countdown = 10
@@ -58,7 +58,6 @@ impl Thing2 {
5858
}
5959
}
6060

61-
#[rustfmt::skip]
6261
fn test2() -> Result<(), ()> {
6362
let thing1 = Thing1{};
6463
let mut
@@ -111,7 +110,6 @@ fn test2() -> Result<(), ()> {
111110
Ok(())
112111
}
113112

114-
#[rustfmt::skip]
115113
fn main() -> Result<(), ()> {
116114
test1().expect_err("test1 should fail");
117115
test2()

tests/coverage/uses_crate.coverage

+13-13
Original file line numberDiff line numberDiff line change
@@ -19,69 +19,69 @@ $DIR/auxiliary/used_crate.rs:
1919
LL| 1|}
2020
LL| |
2121
LL| 2|pub fn used_only_from_bin_crate_generic_function<T: Debug>(arg: T) {
22-
LL| 2| println!("used_only_from_bin_crate_generic_function with {:?}", arg);
22+
LL| 2| println!("used_only_from_bin_crate_generic_function with {arg:?}");
2323
LL| 2|}
2424
------------------
2525
| Unexecuted instantiation: used_crate::used_only_from_bin_crate_generic_function::<_>
2626
------------------
2727
| used_crate::used_only_from_bin_crate_generic_function::<&alloc::vec::Vec<i32>>:
2828
| LL| 1|pub fn used_only_from_bin_crate_generic_function<T: Debug>(arg: T) {
29-
| LL| 1| println!("used_only_from_bin_crate_generic_function with {:?}", arg);
29+
| LL| 1| println!("used_only_from_bin_crate_generic_function with {arg:?}");
3030
| LL| 1|}
3131
------------------
3232
| used_crate::used_only_from_bin_crate_generic_function::<&str>:
3333
| LL| 1|pub fn used_only_from_bin_crate_generic_function<T: Debug>(arg: T) {
34-
| LL| 1| println!("used_only_from_bin_crate_generic_function with {:?}", arg);
34+
| LL| 1| println!("used_only_from_bin_crate_generic_function with {arg:?}");
3535
| LL| 1|}
3636
------------------
3737
LL| |// Expect for above function: `Unexecuted instantiation` (see below)
3838
LL| 2|pub fn used_only_from_this_lib_crate_generic_function<T: Debug>(arg: T) {
39-
LL| 2| println!("used_only_from_this_lib_crate_generic_function with {:?}", arg);
39+
LL| 2| println!("used_only_from_this_lib_crate_generic_function with {arg:?}");
4040
LL| 2|}
4141
------------------
4242
| used_crate::used_only_from_this_lib_crate_generic_function::<&str>:
4343
| LL| 1|pub fn used_only_from_this_lib_crate_generic_function<T: Debug>(arg: T) {
44-
| LL| 1| println!("used_only_from_this_lib_crate_generic_function with {:?}", arg);
44+
| LL| 1| println!("used_only_from_this_lib_crate_generic_function with {arg:?}");
4545
| LL| 1|}
4646
------------------
4747
| used_crate::used_only_from_this_lib_crate_generic_function::<alloc::vec::Vec<i32>>:
4848
| LL| 1|pub fn used_only_from_this_lib_crate_generic_function<T: Debug>(arg: T) {
49-
| LL| 1| println!("used_only_from_this_lib_crate_generic_function with {:?}", arg);
49+
| LL| 1| println!("used_only_from_this_lib_crate_generic_function with {arg:?}");
5050
| LL| 1|}
5151
------------------
5252
LL| |
5353
LL| 2|pub fn used_from_bin_crate_and_lib_crate_generic_function<T: Debug>(arg: T) {
54-
LL| 2| println!("used_from_bin_crate_and_lib_crate_generic_function with {:?}", arg);
54+
LL| 2| println!("used_from_bin_crate_and_lib_crate_generic_function with {arg:?}");
5555
LL| 2|}
5656
------------------
5757
| used_crate::used_from_bin_crate_and_lib_crate_generic_function::<&str>:
5858
| LL| 1|pub fn used_from_bin_crate_and_lib_crate_generic_function<T: Debug>(arg: T) {
59-
| LL| 1| println!("used_from_bin_crate_and_lib_crate_generic_function with {:?}", arg);
59+
| LL| 1| println!("used_from_bin_crate_and_lib_crate_generic_function with {arg:?}");
6060
| LL| 1|}
6161
------------------
6262
| used_crate::used_from_bin_crate_and_lib_crate_generic_function::<alloc::vec::Vec<i32>>:
6363
| LL| 1|pub fn used_from_bin_crate_and_lib_crate_generic_function<T: Debug>(arg: T) {
64-
| LL| 1| println!("used_from_bin_crate_and_lib_crate_generic_function with {:?}", arg);
64+
| LL| 1| println!("used_from_bin_crate_and_lib_crate_generic_function with {arg:?}");
6565
| LL| 1|}
6666
------------------
6767
LL| |
6868
LL| 2|pub fn used_with_same_type_from_bin_crate_and_lib_crate_generic_function<T: Debug>(arg: T) {
69-
LL| 2| println!("used_with_same_type_from_bin_crate_and_lib_crate_generic_function with {:?}", arg);
69+
LL| 2| println!("used_with_same_type_from_bin_crate_and_lib_crate_generic_function with {arg:?}");
7070
LL| 2|}
7171
------------------
7272
| used_crate::used_with_same_type_from_bin_crate_and_lib_crate_generic_function::<&str>:
7373
| LL| 1|pub fn used_with_same_type_from_bin_crate_and_lib_crate_generic_function<T: Debug>(arg: T) {
74-
| LL| 1| println!("used_with_same_type_from_bin_crate_and_lib_crate_generic_function with {:?}", arg);
74+
| LL| 1| println!("used_with_same_type_from_bin_crate_and_lib_crate_generic_function with {arg:?}");
7575
| LL| 1|}
7676
------------------
7777
| used_crate::used_with_same_type_from_bin_crate_and_lib_crate_generic_function::<&str>:
7878
| LL| 1|pub fn used_with_same_type_from_bin_crate_and_lib_crate_generic_function<T: Debug>(arg: T) {
79-
| LL| 1| println!("used_with_same_type_from_bin_crate_and_lib_crate_generic_function with {:?}", arg);
79+
| LL| 1| println!("used_with_same_type_from_bin_crate_and_lib_crate_generic_function with {arg:?}");
8080
| LL| 1|}
8181
------------------
8282
LL| |
8383
LL| 0|pub fn unused_generic_function<T: Debug>(arg: T) {
84-
LL| 0| println!("unused_generic_function with {:?}", arg);
84+
LL| 0| println!("unused_generic_function with {arg:?}");
8585
LL| 0|}
8686
LL| |
8787
LL| 0|pub fn unused_function() {

0 commit comments

Comments
 (0)