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>
This commit is contained in:
Eliza Weisman 2022-04-07 17:08:42 -07:00
parent 38da7ea655
commit 66514cde8c
4 changed files with 9 additions and 2 deletions

View File

@ -232,5 +232,8 @@ pub mod prelude {
//! extension traits. These traits allow attaching `SpanTrace`s to errors and //! extension traits. These traits allow attaching `SpanTrace`s to errors and
//! subsequently retrieving them from `dyn Error` trait objects. //! 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 _}; pub use crate::{ExtractSpanTrace as _, InstrumentError as _, InstrumentResult as _};
} }

View File

@ -184,6 +184,10 @@ impl Builder {
} }
// TODO(eliza): consider making this a public API? // 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( pub(super) fn from_directives(
&self, &self,
directives: impl IntoIterator<Item = Directive>, directives: impl IntoIterator<Item = Directive>,

View File

@ -152,7 +152,7 @@ where
#[cfg(all(feature = "registry", feature = "std"))] #[cfg(all(feature = "registry", feature = "std"))]
{ {
if let Some(g) = guard.as_mut() { if let Some(g) = guard.as_mut() {
g.is_closing() g.set_closing()
}; };
} }

View File

@ -380,7 +380,7 @@ impl<'a> LookupSpan<'a> for Registry {
// === impl CloseGuard === // === impl CloseGuard ===
impl<'a> CloseGuard<'a> { impl<'a> CloseGuard<'a> {
pub(crate) fn is_closing(&mut self) { pub(crate) fn set_closing(&mut self) {
self.is_closing = true; self.is_closing = true;
} }
} }