From 78caf8afb7bbd463065c5acc383d291aff3de7db Mon Sep 17 00:00:00 2001 From: Xiami Date: Fri, 16 Sep 2022 19:35:06 +0800 Subject: [PATCH] macros: Add dyn keyword for trait objects in valueset! expansion bare_trait_objects lint will become a hard error in Rust 2021. While tracing is still using Rust 2018, bare_trait_objects is a warning in the MSRV and dyn keyword is recommended. --- tracing/src/macros.rs | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/tracing/src/macros.rs b/tracing/src/macros.rs index 3875367d61..8b93c14546 100644 --- a/tracing/src/macros.rs +++ b/tracing/src/macros.rs @@ -2196,79 +2196,79 @@ macro_rules! valueset { // }; (@ { $(,)* $($out:expr),* }, $next:expr, $($k:ident).+ = ?$val:expr, $($rest:tt)*) => { $crate::valueset!( - @ { $($out),*, (&$next, Some(&debug(&$val) as &Value)) }, + @ { $($out),*, (&$next, Some(&debug(&$val) as &dyn Value)) }, $next, $($rest)* ) }; (@ { $(,)* $($out:expr),* }, $next:expr, $($k:ident).+ = %$val:expr, $($rest:tt)*) => { $crate::valueset!( - @ { $($out),*, (&$next, Some(&display(&$val) as &Value)) }, + @ { $($out),*, (&$next, Some(&display(&$val) as &dyn Value)) }, $next, $($rest)* ) }; (@ { $(,)* $($out:expr),* }, $next:expr, $($k:ident).+ = $val:expr, $($rest:tt)*) => { $crate::valueset!( - @ { $($out),*, (&$next, Some(&$val as &Value)) }, + @ { $($out),*, (&$next, Some(&$val as &dyn Value)) }, $next, $($rest)* ) }; (@ { $(,)* $($out:expr),* }, $next:expr, $($k:ident).+, $($rest:tt)*) => { $crate::valueset!( - @ { $($out),*, (&$next, Some(&$($k).+ as &Value)) }, + @ { $($out),*, (&$next, Some(&$($k).+ as &dyn Value)) }, $next, $($rest)* ) }; (@ { $(,)* $($out:expr),* }, $next:expr, ?$($k:ident).+, $($rest:tt)*) => { $crate::valueset!( - @ { $($out),*, (&$next, Some(&debug(&$($k).+) as &Value)) }, + @ { $($out),*, (&$next, Some(&debug(&$($k).+) as &dyn Value)) }, $next, $($rest)* ) }; (@ { $(,)* $($out:expr),* }, $next:expr, %$($k:ident).+, $($rest:tt)*) => { $crate::valueset!( - @ { $($out),*, (&$next, Some(&display(&$($k).+) as &Value)) }, + @ { $($out),*, (&$next, Some(&display(&$($k).+) as &dyn Value)) }, $next, $($rest)* ) }; (@ { $(,)* $($out:expr),* }, $next:expr, $($k:ident).+ = ?$val:expr) => { $crate::valueset!( - @ { $($out),*, (&$next, Some(&debug(&$val) as &Value)) }, + @ { $($out),*, (&$next, Some(&debug(&$val) as &dyn Value)) }, $next, ) }; (@ { $(,)* $($out:expr),* }, $next:expr, $($k:ident).+ = %$val:expr) => { $crate::valueset!( - @ { $($out),*, (&$next, Some(&display(&$val) as &Value)) }, + @ { $($out),*, (&$next, Some(&display(&$val) as &dyn Value)) }, $next, ) }; (@ { $(,)* $($out:expr),* }, $next:expr, $($k:ident).+ = $val:expr) => { $crate::valueset!( - @ { $($out),*, (&$next, Some(&$val as &Value)) }, + @ { $($out),*, (&$next, Some(&$val as &dyn Value)) }, $next, ) }; (@ { $(,)* $($out:expr),* }, $next:expr, $($k:ident).+) => { $crate::valueset!( - @ { $($out),*, (&$next, Some(&$($k).+ as &Value)) }, + @ { $($out),*, (&$next, Some(&$($k).+ as &dyn Value)) }, $next, ) }; (@ { $(,)* $($out:expr),* }, $next:expr, ?$($k:ident).+) => { $crate::valueset!( - @ { $($out),*, (&$next, Some(&debug(&$($k).+) as &Value)) }, + @ { $($out),*, (&$next, Some(&debug(&$($k).+) as &dyn Value)) }, $next, ) }; (@ { $(,)* $($out:expr),* }, $next:expr, %$($k:ident).+) => { $crate::valueset!( - @ { $($out),*, (&$next, Some(&display(&$($k).+) as &Value)) }, + @ { $($out),*, (&$next, Some(&display(&$($k).+) as &dyn Value)) }, $next, ) }; @@ -2276,47 +2276,47 @@ macro_rules! valueset { // Handle literal names (@ { $(,)* $($out:expr),* }, $next:expr, $k:literal = ?$val:expr, $($rest:tt)*) => { $crate::valueset!( - @ { $($out),*, (&$next, Some(&debug(&$val) as &Value)) }, + @ { $($out),*, (&$next, Some(&debug(&$val) as &dyn Value)) }, $next, $($rest)* ) }; (@ { $(,)* $($out:expr),* }, $next:expr, $k:literal = %$val:expr, $($rest:tt)*) => { $crate::valueset!( - @ { $($out),*, (&$next, Some(&display(&$val) as &Value)) }, + @ { $($out),*, (&$next, Some(&display(&$val) as &dyn Value)) }, $next, $($rest)* ) }; (@ { $(,)* $($out:expr),* }, $next:expr, $k:literal = $val:expr, $($rest:tt)*) => { $crate::valueset!( - @ { $($out),*, (&$next, Some(&$val as &Value)) }, + @ { $($out),*, (&$next, Some(&$val as &dyn Value)) }, $next, $($rest)* ) }; (@ { $(,)* $($out:expr),* }, $next:expr, $k:literal = ?$val:expr) => { $crate::valueset!( - @ { $($out),*, (&$next, Some(&debug(&$val) as &Value)) }, + @ { $($out),*, (&$next, Some(&debug(&$val) as &dyn Value)) }, $next, ) }; (@ { $(,)* $($out:expr),* }, $next:expr, $k:literal = %$val:expr) => { $crate::valueset!( - @ { $($out),*, (&$next, Some(&display(&$val) as &Value)) }, + @ { $($out),*, (&$next, Some(&display(&$val) as &dyn Value)) }, $next, ) }; (@ { $(,)* $($out:expr),* }, $next:expr, $k:literal = $val:expr) => { $crate::valueset!( - @ { $($out),*, (&$next, Some(&$val as &Value)) }, + @ { $($out),*, (&$next, Some(&$val as &dyn Value)) }, $next, ) }; // Remainder is unparseable, but exists --- must be format args! (@ { $(,)* $($out:expr),* }, $next:expr, $($rest:tt)+) => { - $crate::valueset!(@ { (&$next, Some(&format_args!($($rest)+) as &Value)), $($out),* }, $next, ) + $crate::valueset!(@ { (&$next, Some(&format_args!($($rest)+) as &dyn Value)), $($out),* }, $next, ) }; // === entry ===