Skip to content

Commit d479ca0

Browse files
authored
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 <[email protected]>
1 parent 556cba2 commit d479ca0

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

tracing/src/macros.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2034,11 +2034,11 @@ macro_rules! fieldset {
20342034
#[macro_export]
20352035
macro_rules! level_to_log {
20362036
($level:expr) => {
2037-
match $level {
2038-
&$crate::Level::ERROR => $crate::log::Level::Error,
2039-
&$crate::Level::WARN => $crate::log::Level::Warn,
2040-
&$crate::Level::INFO => $crate::log::Level::Info,
2041-
&$crate::Level::DEBUG => $crate::log::Level::Debug,
2037+
match *$level {
2038+
$crate::Level::ERROR => $crate::log::Level::Error,
2039+
$crate::Level::WARN => $crate::log::Level::Warn,
2040+
$crate::Level::INFO => $crate::log::Level::Info,
2041+
$crate::Level::DEBUG => $crate::log::Level::Debug,
20422042
_ => $crate::log::Level::Trace,
20432043
}
20442044
};
@@ -2327,7 +2327,7 @@ macro_rules! __tracing_log {
23272327
#[macro_export]
23282328
macro_rules! if_log_enabled {
23292329
($e:expr;) => {
2330-
$crate::if_log_enabled! {{ $e }}
2330+
$crate::if_log_enabled! { $e }
23312331
};
23322332
($if_log:block) => {
23332333
$crate::if_log_enabled! { $if_log else {} }
@@ -2342,7 +2342,7 @@ macro_rules! if_log_enabled {
23422342
#[macro_export]
23432343
macro_rules! if_log_enabled {
23442344
($e:expr;) => {
2345-
$crate::if_log_enabled! {{ $e }}
2345+
$crate::if_log_enabled! { $e }
23462346
};
23472347
($if_log:block) => {
23482348
$crate::if_log_enabled! { $if_log else {} }
@@ -2361,12 +2361,13 @@ macro_rules! if_log_enabled {
23612361
#[macro_export]
23622362
macro_rules! if_log_enabled {
23632363
($e:expr;) => {
2364-
$crate::if_log_enabled! {{ $e }}
2364+
$crate::if_log_enabled! { $e }
23652365
};
23662366
($if_log:block) => {
23672367
$crate::if_log_enabled! { $if_log else {} }
23682368
};
23692369
($if_log:block else $else_block:block) => {
2370+
#[allow(unused_braces)]
23702371
$if_log
23712372
};
23722373
}

tracing/src/span.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ pub struct Entered<'a> {
366366

367367
/// `log` target for span lifecycle (creation/enter/exit/close) records.
368368
#[cfg(feature = "log")]
369-
const LIFECYCLE_LOG_TARGET: &'static str = "tracing::span";
369+
const LIFECYCLE_LOG_TARGET: &str = "tracing::span";
370370

371371
// ===== impl Span =====
372372

0 commit comments

Comments
 (0)