Skip to content

Commit

Permalink
chore: fix Rust 1.60 warnings (#2056)
Browse files Browse the repository at this point in the history
## 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>
  • Loading branch information
hawkw committed Apr 9, 2022
1 parent 38da7ea commit 66514cd
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions tracing-error/src/lib.rs
Expand Up @@ -232,5 +232,8 @@ pub mod prelude {
//! extension traits. These traits allow attaching `SpanTrace`s to errors and
//! subsequently retrieving them from `dyn Error` trait objects.

// apparently `as _` reexpoorts now generate `unreachable_pub` linting? which
// seems wrong to me...
#![allow(unreachable_pub)]
pub use crate::{ExtractSpanTrace as _, InstrumentError as _, InstrumentResult as _};
}
4 changes: 4 additions & 0 deletions tracing-subscriber/src/filter/env/builder.rs
Expand Up @@ -184,6 +184,10 @@ impl Builder {
}

// TODO(eliza): consider making this a public API?
// Clippy doesn't love this naming, because it suggests that `from_` methods
// should not take a `Self`...but in this case, it's the `EnvFilter` that is
// being constructed "from" the directives, rather than the builder itself.
#[allow(clippy::wrong_self_convention)]
pub(super) fn from_directives(
&self,
directives: impl IntoIterator<Item = Directive>,
Expand Down
2 changes: 1 addition & 1 deletion tracing-subscriber/src/layer/layered.rs
Expand Up @@ -152,7 +152,7 @@ where
#[cfg(all(feature = "registry", feature = "std"))]
{
if let Some(g) = guard.as_mut() {
g.is_closing()
g.set_closing()
};
}

Expand Down
2 changes: 1 addition & 1 deletion tracing-subscriber/src/registry/sharded.rs
Expand Up @@ -380,7 +380,7 @@ impl<'a> LookupSpan<'a> for Registry {
// === impl CloseGuard ===

impl<'a> CloseGuard<'a> {
pub(crate) fn is_closing(&mut self) {
pub(crate) fn set_closing(&mut self) {
self.is_closing = true;
}
}
Expand Down

0 comments on commit 66514cd

Please sign in to comment.