Skip to content

Commit

Permalink
[allow(dead_code)] in test
Browse files Browse the repository at this point in the history
  • Loading branch information
9999years committed Oct 21, 2024
1 parent 0928c37 commit e601fe2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tracing-attributes/tests/async_fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,17 @@ async fn test_ret_impl_trait_err(n: i32) -> Result<impl Iterator<Item = i32>, &'
}

#[instrument]
#[allow(dead_code)]
async fn test_async_fn_empty() {}

#[instrument]
#[allow(dead_code)]
async unsafe fn test_async_unsafe_fn_empty() {}

// Reproduces a compile error when an instrumented function body contains inner
// attributes (https://github.com/tokio-rs/tracing/issues/2294).
#[deny(unused_variables)]
#[allow(dead_code, clippy::mixed_attributes_style)]
#[instrument]
async fn repro_async_2294() {
#![allow(unused_variables)]
Expand All @@ -50,6 +53,7 @@ async fn repro_async_2294() {
// with the rustfmt-generated formatting, the lint will not be triggered!
#[rustfmt::skip]
#[deny(clippy::suspicious_else_formatting)]
#[allow(dead_code)]
async fn repro_1613(var: bool) {
println!(
"{}",
Expand All @@ -61,6 +65,7 @@ async fn repro_1613(var: bool) {
// and https://github.com/rust-lang/rust-clippy/issues/7760
#[instrument]
#[deny(clippy::suspicious_else_formatting)]
#[allow(dead_code)]
async fn repro_1613_2() {
// hello world
// else
Expand Down
1 change: 1 addition & 0 deletions tracing-attributes/tests/err.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ fn err() -> Result<u8, TryFromIntError> {
}

#[instrument(err)]
#[allow(dead_code)]
fn err_suspicious_else() -> Result<u8, TryFromIntError> {
{}
u8::try_from(1234)
Expand Down
1 change: 1 addition & 0 deletions tracing-attributes/tests/instrument.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use tracing_mock::*;
// Reproduces a compile error when an instrumented function body contains inner
// attributes (https://github.com/tokio-rs/tracing/issues/2294).
#[deny(unused_variables)]
#[allow(dead_code, clippy::mixed_attributes_style)]
#[instrument]
fn repro_2294() {
#![allow(unused_variables)]
Expand Down

0 comments on commit e601fe2

Please sign in to comment.