1
Fork 0

Various trivial formatting fixes in run-coverage tests

These changes were made by manually running `rustfmt` on all of the test files,
and then manually undoing all cases where the original formatting appeared to
have been deliberate.

  `rustfmt +nightly --config-path=/dev/null --edition=2021 tests/run-coverage*/**/*.rs`
This commit is contained in:
Zalathar 2023-08-17 11:43:10 +10:00
parent 4da38c31d2
commit 8d91e71e9a
30 changed files with 48 additions and 92 deletions

View file

@ -7,7 +7,7 @@
^1 ^1
LL| 3|} LL| 3|}
LL| | LL| |
LL| 1|fn main() -> Result<(),u8> { LL| 1|fn main() -> Result<(), u8> {
LL| 1| let mut countdown = 10; LL| 1| let mut countdown = 10;
LL| 11| while countdown > 0 { LL| 11| while countdown > 0 {
LL| 11| if countdown == 1 { LL| 11| if countdown == 1 {

View file

@ -6,7 +6,7 @@ fn might_fail_assert(one_plus_one: u32) {
assert_eq!(1 + 1, one_plus_one, "the argument was wrong"); assert_eq!(1 + 1, one_plus_one, "the argument was wrong");
} }
fn main() -> Result<(),u8> { fn main() -> Result<(), u8> {
let mut countdown = 10; let mut countdown = 10;
while countdown > 0 { while countdown > 0 {
if countdown == 1 { if countdown == 1 {

View file

@ -9,9 +9,6 @@
^0 ^0
LL| 1|} LL| 1|}
LL| | LL| |
LL| |
LL| |
LL| |
LL| 1|async fn async_func() { LL| 1|async fn async_func() {
LL| 1| println!("async_func was covered"); LL| 1| println!("async_func was covered");
LL| 1| let b = true; LL| 1| let b = true;
@ -21,9 +18,6 @@
^0 ^0
LL| 1|} LL| 1|}
LL| | LL| |
LL| |
LL| |
LL| |
LL| 1|async fn async_func_just_println() { LL| 1|async fn async_func_just_println() {
LL| 1| println!("async_func_just_println was covered"); LL| 1| println!("async_func_just_println was covered");
LL| 1|} LL| 1|}

View file

@ -8,9 +8,6 @@ fn non_async_func() {
} }
} }
async fn async_func() { async fn async_func() {
println!("async_func was covered"); println!("async_func was covered");
let b = true; let b = true;
@ -19,9 +16,6 @@ async fn async_func() {
} }
} }
async fn async_func_just_println() { async fn async_func_just_println() {
println!("async_func_just_println was covered"); println!("async_func_just_println was covered");
} }

View file

@ -4,9 +4,9 @@
mod foo { mod foo {
#[inline(always)] #[inline(always)]
pub fn called() { } pub fn called() {}
fn uncalled() { } fn uncalled() {}
} }
pub mod bar { pub mod bar {

View file

@ -29,12 +29,6 @@ pub fn used_inline_function() {
use_this_lib_crate(); use_this_lib_crate();
} }
#[inline(always)] #[inline(always)]
pub fn used_only_from_bin_crate_generic_function<T: Debug>(arg: T) { pub fn used_only_from_bin_crate_generic_function<T: Debug>(arg: T) {
println!("used_only_from_bin_crate_generic_function with {:?}", arg); println!("used_only_from_bin_crate_generic_function with {:?}", arg);

View file

@ -10,7 +10,7 @@
LL| 1| // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from LL| 1| // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from
LL| 1| // dependent conditions. LL| 1| // dependent conditions.
LL| 1| let is_true = std::env::args().len() == 1; LL| 1| let is_true = std::env::args().len() == 1;
LL| 1| let is_false = ! is_true; LL| 1| let is_false = !is_true;
LL| 1| LL| 1|
LL| 1| let mut some_string = Some(String::from("the string content")); LL| 1| let mut some_string = Some(String::from("the string content"));
LL| 1| println!( LL| 1| println!(

View file

@ -10,7 +10,7 @@ fn main() {
// rustc and LLVM cannot optimize out statements (or coverage counters) downstream from // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from
// dependent conditions. // dependent conditions.
let is_true = std::env::args().len() == 1; let is_true = std::env::args().len() == 1;
let is_false = ! is_true; let is_false = !is_true;
let mut some_string = Some(String::from("the string content")); let mut some_string = Some(String::from("the string content"));
println!( println!(

View file

@ -57,16 +57,12 @@
LL| | let mut future = unsafe { Pin::new_unchecked(&mut future) }; LL| | let mut future = unsafe { Pin::new_unchecked(&mut future) };
LL| | use std::hint::unreachable_unchecked; LL| | use std::hint::unreachable_unchecked;
LL| | static VTABLE: RawWakerVTable = RawWakerVTable::new( LL| | static VTABLE: RawWakerVTable = RawWakerVTable::new(
LL| |
LL| | #[no_coverage] LL| | #[no_coverage]
LL| | |_| unsafe { unreachable_unchecked() }, // clone LL| | |_| unsafe { unreachable_unchecked() }, // clone
LL| |
LL| | #[no_coverage] LL| | #[no_coverage]
LL| | |_| unsafe { unreachable_unchecked() }, // wake LL| | |_| unsafe { unreachable_unchecked() }, // wake
LL| |
LL| | #[no_coverage] LL| | #[no_coverage]
LL| | |_| unsafe { unreachable_unchecked() }, // wake_by_ref LL| | |_| unsafe { unreachable_unchecked() }, // wake_by_ref
LL| |
LL| | #[no_coverage] LL| | #[no_coverage]
LL| | |_| (), LL| | |_| (),
LL| | ); LL| | );

View file

@ -56,16 +56,12 @@ mod executor {
let mut future = unsafe { Pin::new_unchecked(&mut future) }; let mut future = unsafe { Pin::new_unchecked(&mut future) };
use std::hint::unreachable_unchecked; use std::hint::unreachable_unchecked;
static VTABLE: RawWakerVTable = RawWakerVTable::new( static VTABLE: RawWakerVTable = RawWakerVTable::new(
#[no_coverage] #[no_coverage]
|_| unsafe { unreachable_unchecked() }, // clone |_| unsafe { unreachable_unchecked() }, // clone
#[no_coverage] #[no_coverage]
|_| unsafe { unreachable_unchecked() }, // wake |_| unsafe { unreachable_unchecked() }, // wake
#[no_coverage] #[no_coverage]
|_| unsafe { unreachable_unchecked() }, // wake_by_ref |_| unsafe { unreachable_unchecked() }, // wake_by_ref
#[no_coverage] #[no_coverage]
|_| (), |_| (),
); );

View file

@ -59,7 +59,6 @@
LL| | } LL| | }
LL| 0| } LL| 0| }
LL| | LL| |
LL| |
LL| 1| let mut countdown = 0; LL| 1| let mut countdown = 0;
LL| 1| if true { LL| 1| if true {
LL| 1| countdown = 1; LL| 1| countdown = 1;

View file

@ -55,7 +55,6 @@ fn main() {
} }
} }
let mut countdown = 0; let mut countdown = 0;
if true { if true {
countdown = 1; countdown = 1;

View file

@ -11,7 +11,7 @@
LL| 2| } LL| 2| }
LL| |} LL| |}
LL| | LL| |
LL| 1|fn main() -> Result<(),u8> { LL| 1|fn main() -> Result<(), u8> {
LL| 1| let _firecracker = Firework { strength: 1 }; LL| 1| let _firecracker = Firework { strength: 1 };
LL| 1| LL| 1|
LL| 1| let _tnt = Firework { strength: 100 }; LL| 1| let _tnt = Firework { strength: 100 };

View file

@ -11,7 +11,7 @@ impl Drop for Firework {
} }
} }
fn main() -> Result<(),u8> { fn main() -> Result<(), u8> {
let _firecracker = Firework { strength: 1 }; let _firecracker = Firework { strength: 1 };
let _tnt = Firework { strength: 100 }; let _tnt = Firework { strength: 100 };

View file

@ -41,7 +41,7 @@
------------------ ------------------
LL| |} LL| |}
LL| | LL| |
LL| 1|fn main() -> Result<(),u8> { LL| 1|fn main() -> Result<(), u8> {
LL| 1| let mut firecracker = Firework { strength: 1 }; LL| 1| let mut firecracker = Firework { strength: 1 };
LL| 1| firecracker.set_strength(2); LL| 1| firecracker.set_strength(2);
LL| 1| LL| 1|
@ -54,10 +54,6 @@
LL| 1| return Err(1); LL| 1| return Err(1);
LL| 0| } LL| 0| }
LL| 0| LL| 0|
LL| 0|
LL| 0|
LL| 0|
LL| 0|
LL| 0| let _ = Firework { strength: 1000 }; LL| 0| let _ = Firework { strength: 1000 };
LL| 0| LL| 0|
LL| 0| Ok(()) LL| 0| Ok(())

View file

@ -19,7 +19,7 @@ impl<T> Drop for Firework<T> where T: Copy + std::fmt::Display {
} }
} }
fn main() -> Result<(),u8> { fn main() -> Result<(), u8> {
let mut firecracker = Firework { strength: 1 }; let mut firecracker = Firework { strength: 1 };
firecracker.set_strength(2); firecracker.set_strength(2);
@ -32,10 +32,6 @@ fn main() -> Result<(),u8> {
return Err(1); return Err(1);
} }
let _ = Firework { strength: 1000 }; let _ = Firework { strength: 1000 };
Ok(()) Ok(())

View file

@ -5,9 +5,9 @@ $DIR/auxiliary/inline_always_with_dead_code.rs:
LL| | LL| |
LL| |mod foo { LL| |mod foo {
LL| | #[inline(always)] LL| | #[inline(always)]
LL| 2| pub fn called() { } LL| 2| pub fn called() {}
LL| | LL| |
LL| 0| fn uncalled() { } LL| 0| fn uncalled() {}
LL| |} LL| |}
LL| | LL| |
LL| |pub mod bar { LL| |pub mod bar {

View file

@ -6,26 +6,26 @@
LL| | LL| |
LL| |// compile-flags: --edition=2021 LL| |// compile-flags: --edition=2021
LL| | LL| |
LL| |enum Never { } LL| |enum Never {}
LL| | LL| |
LL| |impl Never { LL| |impl Never {
LL| | fn foo(self) { LL| | fn foo(self) {
LL| | match self { } LL| | match self {}
LL| | make().map(|never| match never { }); LL| | make().map(|never| match never {});
LL| | } LL| | }
LL| | LL| |
LL| | fn bar(&self) { LL| | fn bar(&self) {
LL| | match *self { } LL| | match *self {}
LL| | } LL| | }
LL| |} LL| |}
LL| | LL| |
LL| 0|async fn foo2(never: Never) { LL| 0|async fn foo2(never: Never) {
LL| | match never { } LL| | match never {}
LL| |} LL| |}
LL| | LL| |
LL| 0|fn make() -> Option<Never> { LL| 0|fn make() -> Option<Never> {
LL| 0| None LL| 0| None
LL| 0|} LL| 0|}
LL| | LL| |
LL| 1|fn main() { } LL| 1|fn main() {}

View file

@ -6,25 +6,25 @@
// compile-flags: --edition=2021 // compile-flags: --edition=2021
enum Never { } enum Never {}
impl Never { impl Never {
fn foo(self) { fn foo(self) {
match self { } match self {}
make().map(|never| match never { }); make().map(|never| match never {});
} }
fn bar(&self) { fn bar(&self) {
match *self { } match *self {}
} }
} }
async fn foo2(never: Never) { async fn foo2(never: Never) {
match never { } match never {}
} }
fn make() -> Option<Never> { fn make() -> Option<Never> {
None None
} }
fn main() { } fn main() {}

View file

@ -9,8 +9,7 @@
LL| 1| fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { LL| 1| fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
LL| 1| if true { LL| 1| if true {
LL| 1| if false { LL| 1| if false {
LL| 0| while true { LL| 0| while true {}
LL| 0| }
LL| 1| } LL| 1| }
LL| 1| write!(f, "cool")?; LL| 1| write!(f, "cool")?;
^0 ^0

View file

@ -9,8 +9,7 @@ impl std::fmt::Debug for DebugTest {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
if true { if true {
if false { if false {
while true { while true {}
}
} }
write!(f, "cool")?; write!(f, "cool")?;
} else { } else {

View file

@ -12,7 +12,7 @@
LL| 4| result LL| 4| result
LL| 4|} LL| 4|}
LL| | LL| |
LL| 1|fn main() -> Result<(),u8> { LL| 1|fn main() -> Result<(), u8> {
LL| 1| let mut countdown = 10; LL| 1| let mut countdown = 10;
LL| 11| while countdown > 0 { LL| 11| while countdown > 0 {
LL| 11| if countdown == 1 { LL| 11| if countdown == 1 {

View file

@ -12,7 +12,7 @@ fn might_overflow(to_add: u32) -> u32 {
result result
} }
fn main() -> Result<(),u8> { fn main() -> Result<(), u8> {
let mut countdown = 10; let mut countdown = 10;
while countdown > 0 { while countdown > 0 {
if countdown == 1 { if countdown == 1 {

View file

@ -1,7 +1,7 @@
LL| |#![allow(unused_assignments)] LL| |#![allow(unused_assignments)]
LL| |// failure-status: 1 LL| |// failure-status: 1
LL| | LL| |
LL| 6|fn call(return_error: bool) -> Result<(),()> { LL| 6|fn call(return_error: bool) -> Result<(), ()> {
LL| 6| if return_error { LL| 6| if return_error {
LL| 1| Err(()) LL| 1| Err(())
LL| | } else { LL| | } else {
@ -9,7 +9,7 @@
LL| | } LL| | }
LL| 6|} LL| 6|}
LL| | LL| |
LL| 1|fn test1() -> Result<(),()> { LL| 1|fn test1() -> Result<(), ()> {
LL| 1| let mut LL| 1| let mut
LL| 1| countdown = 10 LL| 1| countdown = 10
LL| | ; LL| | ;
@ -38,18 +38,18 @@
LL| | LL| |
LL| |struct Thing1; LL| |struct Thing1;
LL| |impl Thing1 { LL| |impl Thing1 {
LL| 18| fn get_thing_2(&self, return_error: bool) -> Result<Thing2,()> { LL| 18| fn get_thing_2(&self, return_error: bool) -> Result<Thing2, ()> {
LL| 18| if return_error { LL| 18| if return_error {
LL| 1| Err(()) LL| 1| Err(())
LL| | } else { LL| | } else {
LL| 17| Ok(Thing2{}) LL| 17| Ok(Thing2 {})
LL| | } LL| | }
LL| 18| } LL| 18| }
LL| |} LL| |}
LL| | LL| |
LL| |struct Thing2; LL| |struct Thing2;
LL| |impl Thing2 { LL| |impl Thing2 {
LL| 17| fn call(&self, return_error: bool) -> Result<u32,()> { LL| 17| fn call(&self, return_error: bool) -> Result<u32, ()> {
LL| 17| if return_error { LL| 17| if return_error {
LL| 2| Err(()) LL| 2| Err(())
LL| | } else { LL| | } else {
@ -58,7 +58,7 @@
LL| 17| } LL| 17| }
LL| |} LL| |}
LL| | LL| |
LL| 1|fn test2() -> Result<(),()> { LL| 1|fn test2() -> Result<(), ()> {
LL| 1| let thing1 = Thing1{}; LL| 1| let thing1 = Thing1{};
LL| 1| let mut LL| 1| let mut
LL| 1| countdown = 10 LL| 1| countdown = 10
@ -115,7 +115,7 @@
LL| 0| Ok(()) LL| 0| Ok(())
LL| 1|} LL| 1|}
LL| | LL| |
LL| 1|fn main() -> Result<(),()> { LL| 1|fn main() -> Result<(), ()> {
LL| 1| test1().expect_err("test1 should fail"); LL| 1| test1().expect_err("test1 should fail");
LL| 1| test2() LL| 1| test2()
LL| 1| ? LL| 1| ?

View file

@ -1,7 +1,7 @@
#![allow(unused_assignments)] #![allow(unused_assignments)]
// failure-status: 1 // failure-status: 1
fn call(return_error: bool) -> Result<(),()> { fn call(return_error: bool) -> Result<(), ()> {
if return_error { if return_error {
Err(()) Err(())
} else { } else {
@ -9,7 +9,7 @@ fn call(return_error: bool) -> Result<(),()> {
} }
} }
fn test1() -> Result<(),()> { fn test1() -> Result<(), ()> {
let mut let mut
countdown = 10 countdown = 10
; ;
@ -37,18 +37,18 @@ fn test1() -> Result<(),()> {
struct Thing1; struct Thing1;
impl Thing1 { impl Thing1 {
fn get_thing_2(&self, return_error: bool) -> Result<Thing2,()> { fn get_thing_2(&self, return_error: bool) -> Result<Thing2, ()> {
if return_error { if return_error {
Err(()) Err(())
} else { } else {
Ok(Thing2{}) Ok(Thing2 {})
} }
} }
} }
struct Thing2; struct Thing2;
impl Thing2 { impl Thing2 {
fn call(&self, return_error: bool) -> Result<u32,()> { fn call(&self, return_error: bool) -> Result<u32, ()> {
if return_error { if return_error {
Err(()) Err(())
} else { } else {
@ -57,7 +57,7 @@ impl Thing2 {
} }
} }
fn test2() -> Result<(),()> { fn test2() -> Result<(), ()> {
let thing1 = Thing1{}; let thing1 = Thing1{};
let mut let mut
countdown = 10 countdown = 10
@ -109,7 +109,7 @@ fn test2() -> Result<(),()> {
Ok(()) Ok(())
} }
fn main() -> Result<(),()> { fn main() -> Result<(), ()> {
test1().expect_err("test1 should fail"); test1().expect_err("test1 should fail");
test2() test2()
? ?

View file

@ -32,12 +32,6 @@ $DIR/auxiliary/used_inline_crate.rs:
LL| 1| use_this_lib_crate(); LL| 1| use_this_lib_crate();
LL| 1|} LL| 1|}
LL| | LL| |
LL| |
LL| |
LL| |
LL| |
LL| |
LL| |
LL| |#[inline(always)] LL| |#[inline(always)]
LL| 2|pub fn used_only_from_bin_crate_generic_function<T: Debug>(arg: T) { LL| 2|pub fn used_only_from_bin_crate_generic_function<T: Debug>(arg: T) {
LL| 2| println!("used_only_from_bin_crate_generic_function with {:?}", arg); LL| 2| println!("used_only_from_bin_crate_generic_function with {:?}", arg);

View file

@ -1,7 +1,7 @@
LL| |#![allow(unused_assignments)] LL| |#![allow(unused_assignments)]
LL| |// failure-status: 1 LL| |// failure-status: 1
LL| | LL| |
LL| 1|fn main() -> Result<(),u8> { LL| 1|fn main() -> Result<(), u8> {
LL| 1| let mut countdown = 10; LL| 1| let mut countdown = 10;
LL| | while LL| | while
LL| 7| countdown LL| 7| countdown

View file

@ -1,7 +1,7 @@
#![allow(unused_assignments)] #![allow(unused_assignments)]
// failure-status: 1 // failure-status: 1
fn main() -> Result<(),u8> { fn main() -> Result<(), u8> {
let mut countdown = 10; let mut countdown = 10;
while while
countdown countdown

View file

@ -7,7 +7,7 @@
LL| 1|fn main() { LL| 1|fn main() {
LL| 1| let mut generator = || { LL| 1| let mut generator = || {
LL| 1| yield 1; LL| 1| yield 1;
LL| 1| return "foo" LL| 1| return "foo";
LL| 1| }; LL| 1| };
LL| | LL| |
LL| 1| match Pin::new(&mut generator).resume(()) { LL| 1| match Pin::new(&mut generator).resume(()) {
@ -23,7 +23,7 @@
LL| 1| yield 1; LL| 1| yield 1;
LL| 1| yield 2; LL| 1| yield 2;
LL| 0| yield 3; LL| 0| yield 3;
LL| 0| return "foo" LL| 0| return "foo";
LL| 0| }; LL| 0| };
LL| | LL| |
LL| 1| match Pin::new(&mut generator).resume(()) { LL| 1| match Pin::new(&mut generator).resume(()) {

View file

@ -7,7 +7,7 @@ use std::pin::Pin;
fn main() { fn main() {
let mut generator = || { let mut generator = || {
yield 1; yield 1;
return "foo" return "foo";
}; };
match Pin::new(&mut generator).resume(()) { match Pin::new(&mut generator).resume(()) {
@ -23,7 +23,7 @@ fn main() {
yield 1; yield 1;
yield 2; yield 2;
yield 3; yield 3;
return "foo" return "foo";
}; };
match Pin::new(&mut generator).resume(()) { match Pin::new(&mut generator).resume(()) {