mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-06-14 05:51:01 +00:00
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)
This commit is contained in:
@@ -32,18 +32,18 @@ impl<'a> Serializer<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! assert_next_token {
|
macro_rules! assert_next_token {
|
||||||
($ser:expr, $actual:ident) => {
|
($ser:expr, $actual:ident) => {{
|
||||||
assert_next_token!($ser, stringify!($actual), Token::$actual, true);
|
assert_next_token!($ser, stringify!($actual), Token::$actual, true);
|
||||||
};
|
}};
|
||||||
($ser:expr, $actual:ident($v:expr)) => {
|
($ser:expr, $actual:ident($v:expr)) => {{
|
||||||
assert_next_token!(
|
assert_next_token!(
|
||||||
$ser,
|
$ser,
|
||||||
format_args!(concat!(stringify!($actual), "({:?})"), $v),
|
format_args!(concat!(stringify!($actual), "({:?})"), $v),
|
||||||
Token::$actual(v),
|
Token::$actual(v),
|
||||||
v == $v
|
v == $v
|
||||||
);
|
);
|
||||||
};
|
}};
|
||||||
($ser:expr, $actual:ident { $($k:ident),* }) => {
|
($ser:expr, $actual:ident { $($k:ident),* }) => {{
|
||||||
let compare = ($($k,)*);
|
let compare = ($($k,)*);
|
||||||
let field_format = || {
|
let field_format = || {
|
||||||
use std::fmt::Write;
|
use std::fmt::Write;
|
||||||
@@ -59,7 +59,7 @@ macro_rules! assert_next_token {
|
|||||||
Token::$actual { $($k),* },
|
Token::$actual { $($k),* },
|
||||||
($($k,)*) == compare
|
($($k,)*) == compare
|
||||||
);
|
);
|
||||||
};
|
}};
|
||||||
($ser:expr, $actual:expr, $pat:pat, $guard:expr) => {
|
($ser:expr, $actual:expr, $pat:pat, $guard:expr) => {
|
||||||
match $ser.next_token() {
|
match $ser.next_token() {
|
||||||
Some($pat) if $guard => {}
|
Some($pat) if $guard => {}
|
||||||
|
|||||||
Reference in New Issue
Block a user