From 9adfa7bebddc534aedc23db74bbc0d4de36cbb2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20Ci=C4=99=C5=BCarkiewicz?= Date: Thu, 2 May 2024 04:25:51 -0700 Subject: [PATCH] chore: new clippy/rust lints (#2948) ## Motivation clippy is failing with recent Rust toolchain up to 1.77.2. ## Solution Give clippy what it wants. --- tracing-attributes/src/expand.rs | 1 + tracing-attributes/tests/instrument.rs | 1 + tracing-core/src/dispatch.rs | 1 + tracing-core/src/field.rs | 2 ++ tracing-futures/tests/std_future.rs | 1 + tracing-subscriber/src/registry/sharded.rs | 1 + tracing/tests/instrument.rs | 1 + 7 files changed, 8 insertions(+) diff --git a/tracing-attributes/src/expand.rs b/tracing-attributes/src/expand.rs index a92ef58aee..b52cb12aba 100644 --- a/tracing-attributes/src/expand.rs +++ b/tracing-attributes/src/expand.rs @@ -795,6 +795,7 @@ impl<'a> VisitMut for IdentAndTypesRenamer<'a> { } // A visitor struct that replace an async block by its patched version +#[allow(dead_code)] struct AsyncTraitBlockReplacer<'a> { block: &'a Block, patched_block: Block, diff --git a/tracing-attributes/tests/instrument.rs b/tracing-attributes/tests/instrument.rs index 0376be4069..957567dcf9 100644 --- a/tracing-attributes/tests/instrument.rs +++ b/tracing-attributes/tests/instrument.rs @@ -100,6 +100,7 @@ fn fields() { #[test] fn skip() { + #[allow(dead_code)] struct UnDebug(pub u32); #[instrument(target = "my_target", level = "debug", skip(_arg2, _arg3))] diff --git a/tracing-core/src/dispatch.rs b/tracing-core/src/dispatch.rs index ab3ccd4ba8..53263b494d 100644 --- a/tracing-core/src/dispatch.rs +++ b/tracing-core/src/dispatch.rs @@ -510,6 +510,7 @@ pub(crate) fn get_global() -> &'static Dispatch { unsafe { // This is safe given the invariant that setting the global dispatcher // also sets `GLOBAL_INIT` to `INITIALIZED`. + #[allow(static_mut_refs)] &GLOBAL_DISPATCH } } diff --git a/tracing-core/src/field.rs b/tracing-core/src/field.rs index d7a01bb814..d9ba1707cd 100644 --- a/tracing-core/src/field.rs +++ b/tracing-core/src/field.rs @@ -966,6 +966,7 @@ mod test { use crate::metadata::{Kind, Level, Metadata}; // Make sure TEST_CALLSITE_* have non-zero size, so they can't be located at the same address. + #[allow(dead_code)] struct TestCallsite1(u8); static TEST_CALLSITE_1: TestCallsite1 = TestCallsite1(0); static TEST_META_1: Metadata<'static> = metadata! { @@ -987,6 +988,7 @@ mod test { } } + #[allow(dead_code)] struct TestCallsite2(u8); static TEST_CALLSITE_2: TestCallsite2 = TestCallsite2(0); static TEST_META_2: Metadata<'static> = metadata! { diff --git a/tracing-futures/tests/std_future.rs b/tracing-futures/tests/std_future.rs index d550896524..d8ec669175 100644 --- a/tracing-futures/tests/std_future.rs +++ b/tracing-futures/tests/std_future.rs @@ -55,6 +55,7 @@ fn span_on_drop() { } } + #[allow(dead_code)] struct Fut(Option); impl Future for Fut { diff --git a/tracing-subscriber/src/registry/sharded.rs b/tracing-subscriber/src/registry/sharded.rs index a6c06391fa..c915109fe5 100644 --- a/tracing-subscriber/src/registry/sharded.rs +++ b/tracing-subscriber/src/registry/sharded.rs @@ -592,6 +592,7 @@ mod tests { closed: Vec<(&'static str, Weak<()>)>, } + #[allow(dead_code)] struct SetRemoved(Arc<()>); impl Subscribe for CloseSubscriber diff --git a/tracing/tests/instrument.rs b/tracing/tests/instrument.rs index 9cb4dfbb3f..6e48de6bfc 100644 --- a/tracing/tests/instrument.rs +++ b/tracing/tests/instrument.rs @@ -21,6 +21,7 @@ fn span_on_drop() { } } + #[allow(dead_code)] struct Fut(Option); impl Future for Fut {