Skip to content

Commit fafc5c9

Browse files
authored
chore: clean up warnings on master (#3087)
Forward-porting #3069.
1 parent 527b4f6 commit fafc5c9

File tree

24 files changed

+71
-28
lines changed

24 files changed

+71
-28
lines changed

Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,8 @@ members = [
1818
"tracing-journald",
1919
"examples"
2020
]
21+
22+
# This will be ignored with Rust older than 1.74, but for now that's okay;
23+
# we're only using it to fix check-cfg issues that first appeared in Rust 1.80.
24+
[workspace.lints.rust]
25+
unexpected_cfgs = { level = "warn", check-cfg = ["cfg(flaky_tests)", "cfg(tracing_unstable)"] }

examples/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,6 @@ tempfile = "3.3.0"
5050
# fmt examples
5151
snafu = "0.6.10"
5252
thiserror = "1.0.31"
53+
54+
[lints]
55+
workspace = true

tracing-attributes/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,6 @@ rustversion = "1.0.9"
6060

6161
[badges]
6262
maintenance = { status = "experimental" }
63+
64+
[lints]
65+
workspace = true

tracing-attributes/tests/instrument.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,7 @@ fn fields() {
100100

101101
#[test]
102102
fn skip() {
103-
#[allow(dead_code)]
104-
struct UnDebug(pub u32);
103+
struct UnDebug();
105104

106105
#[instrument(target = "my_target", level = "debug", skip(_arg2, _arg3))]
107106
fn my_fn(arg1: usize, _arg2: UnDebug, _arg3: UnDebug) {}
@@ -135,8 +134,8 @@ fn skip() {
135134
.run_with_handle();
136135

137136
with_default(collector, || {
138-
my_fn(2, UnDebug(0), UnDebug(1));
139-
my_fn(3, UnDebug(0), UnDebug(1));
137+
my_fn(2, UnDebug(), UnDebug());
138+
my_fn(3, UnDebug(), UnDebug());
140139
});
141140

142141
handle.assert_finished();

tracing-core/Cargo.toml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,11 @@ once_cell = { version = "1.13.0", optional = true }
3939

4040
[package.metadata.docs.rs]
4141
all-features = true
42-
rustdoc-args = ["--cfg", "docsrs"]
42+
# enable unstable features in the documentation
43+
rustdoc-args = ["--cfg", "docsrs", "--cfg", "tracing_unstable"]
44+
# it's necessary to _also_ pass `--cfg tracing_unstable` to rustc, or else
45+
# dependencies will not be enabled, and the docs build will fail.
46+
rustc-args = ["--cfg", "tracing_unstable"]
47+
48+
[lints]
49+
workspace = true

tracing-core/src/field.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -999,9 +999,8 @@ mod test {
999999
use crate::metadata::{Kind, Level, Metadata};
10001000

10011001
// Make sure TEST_CALLSITE_* have non-zero size, so they can't be located at the same address.
1002-
#[allow(dead_code)]
1003-
struct TestCallsite1(u8);
1004-
static TEST_CALLSITE_1: TestCallsite1 = TestCallsite1(0);
1002+
struct TestCallsite1();
1003+
static TEST_CALLSITE_1: TestCallsite1 = TestCallsite1();
10051004
static TEST_META_1: Metadata<'static> = metadata! {
10061005
name: "field_test1",
10071006
target: module_path!(),
@@ -1021,9 +1020,8 @@ mod test {
10211020
}
10221021
}
10231022

1024-
#[allow(dead_code)]
1025-
struct TestCallsite2(u8);
1026-
static TEST_CALLSITE_2: TestCallsite2 = TestCallsite2(0);
1023+
struct TestCallsite2();
1024+
static TEST_CALLSITE_2: TestCallsite2 = TestCallsite2();
10271025
static TEST_META_2: Metadata<'static> = metadata! {
10281026
name: "field_test2",
10291027
target: module_path!(),

tracing-futures/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,6 @@ maintenance = { status = "actively-developed" }
5252
[package.metadata.docs.rs]
5353
all-features = true
5454
rustdoc-args = ["--cfg", "docsrs"]
55+
56+
[lints]
57+
workspace = true

tracing-futures/src/executor/futures_01.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ where
3535
}
3636

3737
#[cfg(feature = "tokio")]
38-
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
38+
#[allow(unreachable_pub, unused_imports)] // https://github.com/rust-lang/rust/issues/57411
3939
pub use self::tokio::*;
4040

4141
#[cfg(feature = "tokio")]

tracing-futures/src/executor/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ mod futures_01;
33

44
#[cfg(feature = "futures-03")]
55
mod futures_03;
6+
#[allow(unreachable_pub, unused_imports)]
67
#[cfg(feature = "futures-03")]
7-
pub use self::futures_03::*;
8+
pub use futures_03::*;

tracing-futures/tests/std_future.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ fn span_on_drop() {
5555
}
5656
}
5757

58-
#[allow(dead_code)]
58+
#[allow(dead_code)] // Field unused, but logs on `Drop`
5959
struct Fut(Option<AssertSpanOnDrop>);
6060

6161
impl Future for Fut {

0 commit comments

Comments
 (0)