Skip to content

Commit 66514cd

Browse files
committed
chore: fix Rust 1.60 warnings (#2056)
## Motivation The Rust 1.60 release introduced a few new lints that trigger on the `tracing` codebase. In particular, `clippy` added some new lints for method naming, and the `unreachable_pub` lint now seems to be triggered incorrectly by `pub use foo as _` re-exports. ## Solution This branch fixes the lints. Signed-off-by: Eliza Weisman <eliza@buoyant.io>
1 parent 38da7ea commit 66514cd

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

tracing-error/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,5 +232,8 @@ pub mod prelude {
232232
//! extension traits. These traits allow attaching `SpanTrace`s to errors and
233233
//! subsequently retrieving them from `dyn Error` trait objects.
234234
235+
// apparently `as _` reexpoorts now generate `unreachable_pub` linting? which
236+
// seems wrong to me...
237+
#![allow(unreachable_pub)]
235238
pub use crate::{ExtractSpanTrace as _, InstrumentError as _, InstrumentResult as _};
236239
}

tracing-subscriber/src/filter/env/builder.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,10 @@ impl Builder {
184184
}
185185

186186
// TODO(eliza): consider making this a public API?
187+
// Clippy doesn't love this naming, because it suggests that `from_` methods
188+
// should not take a `Self`...but in this case, it's the `EnvFilter` that is
189+
// being constructed "from" the directives, rather than the builder itself.
190+
#[allow(clippy::wrong_self_convention)]
187191
pub(super) fn from_directives(
188192
&self,
189193
directives: impl IntoIterator<Item = Directive>,

tracing-subscriber/src/layer/layered.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ where
152152
#[cfg(all(feature = "registry", feature = "std"))]
153153
{
154154
if let Some(g) = guard.as_mut() {
155-
g.is_closing()
155+
g.set_closing()
156156
};
157157
}
158158

tracing-subscriber/src/registry/sharded.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ impl<'a> LookupSpan<'a> for Registry {
380380
// === impl CloseGuard ===
381381

382382
impl<'a> CloseGuard<'a> {
383-
pub(crate) fn is_closing(&mut self) {
383+
pub(crate) fn set_closing(&mut self) {
384384
self.is_closing = true;
385385
}
386386
}

0 commit comments

Comments
 (0)