Skip to content

Commit 72b721f

Browse files
committed
Resolve all warnings in run-coverage tests
When one of these tests fails, any compiler warnings will be printed to the console, which makes it harder to track down the actual reason for failure. (The outstanding warnings were found by temporarily adding `-Dwarnings` to the compiler arguments for `RunCoverage` in `src/tools/compiletest/src/runtest.rs`.)
1 parent 9334ec9 commit 72b721f

20 files changed

+22
-20
lines changed

tests/run-coverage/async2.coverage

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
LL| |// compile-flags: --edition=2018
22
LL| |
3-
LL| |use core::{
4-
LL| | future::Future,
5-
LL| | marker::Send,
6-
LL| | pin::Pin,
7-
LL| |};
8-
LL| |
93
LL| 1|fn non_async_func() {
104
LL| 1| println!("non_async_func was covered");
115
LL| 1| let b = true;

tests/run-coverage/async2.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
// compile-flags: --edition=2018
22

3-
use core::{
4-
future::Future,
5-
marker::Send,
6-
pin::Pin,
7-
};
8-
93
fn non_async_func() {
104
println!("non_async_func was covered");
115
let b = true;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#[allow(dead_code)]
12
pub fn never_called_function() {
23
println!("I am never called");
34
}

tests/run-coverage/auxiliary/used_crate.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ pub fn unused_function() {
4242
}
4343
}
4444

45+
#[allow(dead_code)]
4546
fn unused_private_function() {
4647
let is_true = std::env::args().len() == 1;
4748
let mut countdown = 2;

tests/run-coverage/auxiliary/used_inline_crate.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ pub fn unused_function() {
7171
}
7272

7373
#[inline(always)]
74+
#[allow(dead_code)]
7475
fn unused_private_function() {
7576
let is_true = std::env::args().len() == 1;
7677
let mut countdown = 2;

tests/run-coverage/closure_macro_async.coverage

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
LL| |
4343
LL| |#[no_coverage]
4444
LL| |fn main() {
45-
LL| | executor::block_on(test());
45+
LL| | executor::block_on(test()).unwrap();
4646
LL| |}
4747
LL| |
4848
LL| |mod executor {

tests/run-coverage/closure_macro_async.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pub async fn test() -> Result<(), String> {
4141

4242
#[no_coverage]
4343
fn main() {
44-
executor::block_on(test());
44+
executor::block_on(test()).unwrap();
4545
}
4646

4747
mod executor {

tests/run-coverage/dead_code.coverage

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
LL| |#![allow(unused_assignments, unused_variables)]
1+
LL| |#![allow(dead_code, unused_assignments, unused_variables)]
22
LL| |
33
LL| 0|pub fn unused_pub_fn_not_in_library() {
44
LL| 0| // Initialize test constants in a way that cannot be determined at compile time, to ensure

tests/run-coverage/dead_code.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![allow(unused_assignments, unused_variables)]
1+
#![allow(dead_code, unused_assignments, unused_variables)]
22

33
pub fn unused_pub_fn_not_in_library() {
44
// Initialize test constants in a way that cannot be determined at compile time, to ensure

tests/run-coverage/issue-93054.coverage

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
LL| |#![allow(dead_code, unreachable_code)]
2+
LL| |
13
LL| |// Regression test for #93054: Functions using uninhabited types often only have a single,
24
LL| |// unreachable basic block which doesn't get instrumented. This should not cause llvm-cov to fail.
35
LL| |// Since these kinds functions can't be invoked anyway, it's ok to not have coverage data for them.

0 commit comments

Comments
 (0)