From 8b840c3030073446f2c14911cfe46df53e64d894 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Fri, 30 Jul 2021 20:49:53 -0700 Subject: [PATCH] Resolve semicolon_in_expressions_from_macros warning in serde_test warning: trailing semicolon in macro used in expression position --> serde_test/src/ser.rs:44:10 | 44 | ); | ^ ... 152 | Some(&Token::BorrowedStr(_)) => assert_next_token!(self, BorrowedStr(v)), | ---------------------------------------- in this macro invocation | = note: `#[warn(semicolon_in_expressions_from_macros)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: this warning originates in the macro `assert_next_token` (in Nightly builds, run with -Z macro-backtrace for more info) warning: trailing semicolon in macro used in expression position --> serde_test/src/ser.rs:36:76 | 36 | assert_next_token!($ser, stringify!($actual), Token::$actual, true); | ^ ... 386 | Token::TupleVariantEnd => assert_next_token!(self.ser, TupleVariantEnd), | --------------------------------------------- in this macro invocation | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: this warning originates in the macro `assert_next_token` (in Nightly builds, run with -Z macro-backtrace for more info) --- serde_test/src/ser.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/serde_test/src/ser.rs b/serde_test/src/ser.rs index a980a046a..0827e793c 100644 --- a/serde_test/src/ser.rs +++ b/serde_test/src/ser.rs @@ -32,18 +32,18 @@ impl<'a> Serializer<'a> { } macro_rules! assert_next_token { - ($ser:expr, $actual:ident) => { + ($ser:expr, $actual:ident) => {{ assert_next_token!($ser, stringify!($actual), Token::$actual, true); - }; - ($ser:expr, $actual:ident($v:expr)) => { + }}; + ($ser:expr, $actual:ident($v:expr)) => {{ assert_next_token!( $ser, format_args!(concat!(stringify!($actual), "({:?})"), $v), Token::$actual(v), v == $v ); - }; - ($ser:expr, $actual:ident { $($k:ident),* }) => { + }}; + ($ser:expr, $actual:ident { $($k:ident),* }) => {{ let compare = ($($k,)*); let field_format = || { use std::fmt::Write; @@ -59,7 +59,7 @@ macro_rules! assert_next_token { Token::$actual { $($k),* }, ($($k,)*) == compare ); - }; + }}; ($ser:expr, $actual:expr, $pat:pat, $guard:expr) => { match $ser.next_token() { Some($pat) if $guard => {}