tracing: fix warnings with log/log-always features (#753)

This commit fixes up a few new Clippy lints and rustc warnings that
occur with the `log`/`log-always` features enabled.

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
This commit is contained in:
Eliza Weisman 2020-06-19 09:55:24 -07:00 committed by GitHub
parent 556cba2b8d
commit d479ca04bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 9 deletions

View File

@ -2034,11 +2034,11 @@ macro_rules! fieldset {
#[macro_export]
macro_rules! level_to_log {
($level:expr) => {
match $level {
&$crate::Level::ERROR => $crate::log::Level::Error,
&$crate::Level::WARN => $crate::log::Level::Warn,
&$crate::Level::INFO => $crate::log::Level::Info,
&$crate::Level::DEBUG => $crate::log::Level::Debug,
match *$level {
$crate::Level::ERROR => $crate::log::Level::Error,
$crate::Level::WARN => $crate::log::Level::Warn,
$crate::Level::INFO => $crate::log::Level::Info,
$crate::Level::DEBUG => $crate::log::Level::Debug,
_ => $crate::log::Level::Trace,
}
};
@ -2327,7 +2327,7 @@ macro_rules! __tracing_log {
#[macro_export]
macro_rules! if_log_enabled {
($e:expr;) => {
$crate::if_log_enabled! {{ $e }}
$crate::if_log_enabled! { $e }
};
($if_log:block) => {
$crate::if_log_enabled! { $if_log else {} }
@ -2342,7 +2342,7 @@ macro_rules! if_log_enabled {
#[macro_export]
macro_rules! if_log_enabled {
($e:expr;) => {
$crate::if_log_enabled! {{ $e }}
$crate::if_log_enabled! { $e }
};
($if_log:block) => {
$crate::if_log_enabled! { $if_log else {} }
@ -2361,12 +2361,13 @@ macro_rules! if_log_enabled {
#[macro_export]
macro_rules! if_log_enabled {
($e:expr;) => {
$crate::if_log_enabled! {{ $e }}
$crate::if_log_enabled! { $e }
};
($if_log:block) => {
$crate::if_log_enabled! { $if_log else {} }
};
($if_log:block else $else_block:block) => {
#[allow(unused_braces)]
$if_log
};
}

View File

@ -366,7 +366,7 @@ pub struct Entered<'a> {
/// `log` target for span lifecycle (creation/enter/exit/close) records.
#[cfg(feature = "log")]
const LIFECYCLE_LOG_TARGET: &'static str = "tracing::span";
const LIFECYCLE_LOG_TARGET: &str = "tracing::span";
// ===== impl Span =====