Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
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`
  • Loading branch information
Zalathar committed Aug 26, 2023
commit 8d91e71e9a015c864b29725ec9430c5db4325cf4
2 changes: 1 addition & 1 deletion tests/run-coverage/assert.coverage
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
^1
LL| 3|}
LL| |
LL| 1|fn main() -> Result<(),u8> {
LL| 1|fn main() -> Result<(), u8> {
LL| 1| let mut countdown = 10;
LL| 11| while countdown > 0 {
LL| 11| if countdown == 1 {
Expand Down
2 changes: 1 addition & 1 deletion tests/run-coverage/assert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ fn might_fail_assert(one_plus_one: u32) {
assert_eq!(1 + 1, one_plus_one, "the argument was wrong");
}

fn main() -> Result<(),u8> {
fn main() -> Result<(), u8> {
let mut countdown = 10;
while countdown > 0 {
if countdown == 1 {
Expand Down
6 changes: 0 additions & 6 deletions tests/run-coverage/async2.coverage
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
^0
LL| 1|}
LL| |
LL| |
LL| |
LL| |
LL| 1|async fn async_func() {
LL| 1| println!("async_func was covered");
LL| 1| let b = true;
Expand All @@ -21,9 +18,6 @@
^0
LL| 1|}
LL| |
LL| |
LL| |
LL| |
LL| 1|async fn async_func_just_println() {
LL| 1| println!("async_func_just_println was covered");
LL| 1|}
Expand Down
6 changes: 0 additions & 6 deletions tests/run-coverage/async2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ fn non_async_func() {
}
}




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




async fn async_func_just_println() {
println!("async_func_just_println was covered");
}
Expand Down
4 changes: 2 additions & 2 deletions tests/run-coverage/auxiliary/inline_always_with_dead_code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

mod foo {
#[inline(always)]
pub fn called() { }
pub fn called() {}

fn uncalled() { }
fn uncalled() {}
}

pub mod bar {
Expand Down
6 changes: 0 additions & 6 deletions tests/run-coverage/auxiliary/used_inline_crate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ pub fn used_inline_function() {
use_this_lib_crate();
}







#[inline(always)]
pub fn used_only_from_bin_crate_generic_function<T: Debug>(arg: T) {
println!("used_only_from_bin_crate_generic_function with {:?}", arg);
Expand Down
2 changes: 1 addition & 1 deletion tests/run-coverage/closure.coverage
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
LL| 1| // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from
LL| 1| // dependent conditions.
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| let mut some_string = Some(String::from("the string content"));
LL| 1| println!(
Expand Down
2 changes: 1 addition & 1 deletion tests/run-coverage/closure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fn main() {
// rustc and LLVM cannot optimize out statements (or coverage counters) downstream from
// dependent conditions.
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"));
println!(
Expand Down
4 changes: 0 additions & 4 deletions tests/run-coverage/closure_macro_async.coverage
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,12 @@
LL| | let mut future = unsafe { Pin::new_unchecked(&mut future) };
LL| | use std::hint::unreachable_unchecked;
LL| | static VTABLE: RawWakerVTable = RawWakerVTable::new(
LL| |
LL| | #[no_coverage]
LL| | |_| unsafe { unreachable_unchecked() }, // clone
LL| |
LL| | #[no_coverage]
LL| | |_| unsafe { unreachable_unchecked() }, // wake
LL| |
LL| | #[no_coverage]
LL| | |_| unsafe { unreachable_unchecked() }, // wake_by_ref
LL| |
LL| | #[no_coverage]
LL| | |_| (),
LL| | );
Expand Down
4 changes: 0 additions & 4 deletions tests/run-coverage/closure_macro_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,12 @@ mod executor {
let mut future = unsafe { Pin::new_unchecked(&mut future) };
use std::hint::unreachable_unchecked;
static VTABLE: RawWakerVTable = RawWakerVTable::new(

#[no_coverage]
|_| unsafe { unreachable_unchecked() }, // clone

#[no_coverage]
|_| unsafe { unreachable_unchecked() }, // wake

#[no_coverage]
|_| unsafe { unreachable_unchecked() }, // wake_by_ref

#[no_coverage]
|_| (),
);
Expand Down
1 change: 0 additions & 1 deletion tests/run-coverage/conditions.coverage
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
LL| | }
LL| 0| }
LL| |
LL| |
LL| 1| let mut countdown = 0;
LL| 1| if true {
LL| 1| countdown = 1;
Expand Down
1 change: 0 additions & 1 deletion tests/run-coverage/conditions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ fn main() {
}
}


let mut countdown = 0;
if true {
countdown = 1;
Expand Down
2 changes: 1 addition & 1 deletion tests/run-coverage/drop_trait.coverage
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
LL| 2| }
LL| |}
LL| |
LL| 1|fn main() -> Result<(),u8> {
LL| 1|fn main() -> Result<(), u8> {
LL| 1| let _firecracker = Firework { strength: 1 };
LL| 1|
LL| 1| let _tnt = Firework { strength: 100 };
Expand Down
2 changes: 1 addition & 1 deletion tests/run-coverage/drop_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ impl Drop for Firework {
}
}

fn main() -> Result<(),u8> {
fn main() -> Result<(), u8> {
let _firecracker = Firework { strength: 1 };

let _tnt = Firework { strength: 100 };
Expand Down
6 changes: 1 addition & 5 deletions tests/run-coverage/generics.coverage
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
------------------
LL| |}
LL| |
LL| 1|fn main() -> Result<(),u8> {
LL| 1|fn main() -> Result<(), u8> {
LL| 1| let mut firecracker = Firework { strength: 1 };
LL| 1| firecracker.set_strength(2);
LL| 1|
Expand All @@ -54,10 +54,6 @@
LL| 1| return Err(1);
LL| 0| }
LL| 0|
LL| 0|
LL| 0|
LL| 0|
LL| 0|
LL| 0| let _ = Firework { strength: 1000 };
LL| 0|
LL| 0| Ok(())
Expand Down
6 changes: 1 addition & 5 deletions tests/run-coverage/generics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
firecracker.set_strength(2);

Expand All @@ -32,10 +32,6 @@ fn main() -> Result<(),u8> {
return Err(1);
}





let _ = Firework { strength: 1000 };

Ok(())
Expand Down
4 changes: 2 additions & 2 deletions tests/run-coverage/issue-85461.coverage
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ $DIR/auxiliary/inline_always_with_dead_code.rs:
LL| |
LL| |mod foo {
LL| | #[inline(always)]
LL| 2| pub fn called() { }
LL| 2| pub fn called() {}
LL| |
LL| 0| fn uncalled() { }
LL| 0| fn uncalled() {}
LL| |}
LL| |
LL| |pub mod bar {
Expand Down
12 changes: 6 additions & 6 deletions tests/run-coverage/issue-93054.coverage
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,26 @@
LL| |
LL| |// compile-flags: --edition=2021
LL| |
LL| |enum Never { }
LL| |enum Never {}
LL| |
LL| |impl Never {
LL| | fn foo(self) {
LL| | match self { }
LL| | make().map(|never| match never { });
LL| | match self {}
LL| | make().map(|never| match never {});
LL| | }
LL| |
LL| | fn bar(&self) {
LL| | match *self { }
LL| | match *self {}
LL| | }
LL| |}
LL| |
LL| 0|async fn foo2(never: Never) {
LL| | match never { }
LL| | match never {}
LL| |}
LL| |
LL| 0|fn make() -> Option<Never> {
LL| 0| None
LL| 0|}
LL| |
LL| 1|fn main() { }
LL| 1|fn main() {}

12 changes: 6 additions & 6 deletions tests/run-coverage/issue-93054.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@

// compile-flags: --edition=2021

enum Never { }
enum Never {}

impl Never {
fn foo(self) {
match self { }
make().map(|never| match never { });
match self {}
make().map(|never| match never {});
}

fn bar(&self) {
match *self { }
match *self {}
}
}

async fn foo2(never: Never) {
match never { }
match never {}
}

fn make() -> Option<Never> {
None
}

fn main() { }
fn main() {}
3 changes: 1 addition & 2 deletions tests/run-coverage/loops_branches.coverage
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
LL| 1| fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
LL| 1| if true {
LL| 1| if false {
LL| 0| while true {
LL| 0| }
LL| 0| while true {}
LL| 1| }
LL| 1| write!(f, "cool")?;
^0
Expand Down
3 changes: 1 addition & 2 deletions tests/run-coverage/loops_branches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ impl std::fmt::Debug for DebugTest {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
if true {
if false {
while true {
}
while true {}
}
write!(f, "cool")?;
} else {
Expand Down
2 changes: 1 addition & 1 deletion tests/run-coverage/overflow.coverage
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
LL| 4| result
LL| 4|}
LL| |
LL| 1|fn main() -> Result<(),u8> {
LL| 1|fn main() -> Result<(), u8> {
LL| 1| let mut countdown = 10;
LL| 11| while countdown > 0 {
LL| 11| if countdown == 1 {
Expand Down
2 changes: 1 addition & 1 deletion tests/run-coverage/overflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fn might_overflow(to_add: u32) -> u32 {
result
}

fn main() -> Result<(),u8> {
fn main() -> Result<(), u8> {
let mut countdown = 10;
while countdown > 0 {
if countdown == 1 {
Expand Down
14 changes: 7 additions & 7 deletions tests/run-coverage/try_error_result.coverage
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
LL| |#![allow(unused_assignments)]
LL| |// failure-status: 1
LL| |
LL| 6|fn call(return_error: bool) -> Result<(),()> {
LL| 6|fn call(return_error: bool) -> Result<(), ()> {
LL| 6| if return_error {
LL| 1| Err(())
LL| | } else {
LL| 5| Ok(())
LL| | }
LL| 6|}
LL| |
LL| 1|fn test1() -> Result<(),()> {
LL| 1|fn test1() -> Result<(), ()> {
LL| 1| let mut
LL| 1| countdown = 10
LL| | ;
Expand Down Expand Up @@ -38,18 +38,18 @@
LL| |
LL| |struct 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| 1| Err(())
LL| | } else {
LL| 17| Ok(Thing2{})
LL| 17| Ok(Thing2 {})
LL| | }
LL| 18| }
LL| |}
LL| |
LL| |struct 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| 2| Err(())
LL| | } else {
Expand All @@ -58,7 +58,7 @@
LL| 17| }
LL| |}
LL| |
LL| 1|fn test2() -> Result<(),()> {
LL| 1|fn test2() -> Result<(), ()> {
LL| 1| let thing1 = Thing1{};
LL| 1| let mut
LL| 1| countdown = 10
Expand Down Expand Up @@ -115,7 +115,7 @@
LL| 0| Ok(())
LL| 1|}
LL| |
LL| 1|fn main() -> Result<(),()> {
LL| 1|fn main() -> Result<(), ()> {
LL| 1| test1().expect_err("test1 should fail");
LL| 1| test2()
LL| 1| ?
Expand Down
Loading