diff --git a/json/src/macros.rs b/json/src/macros.rs index 8ac4484..7a34c2c 100644 --- a/json/src/macros.rs +++ b/json/src/macros.rs @@ -196,6 +196,12 @@ macro_rules! json_internal { json_internal!(@object $object [,] (,)); }; + // Key is fully parenthesized. This avoids clippy double_parens false + // positives because the parenthesization may be necessary here. + (@object $object:ident () ($key:expr) : $($rest:tt)*) => { + json_internal!(@object $object ($key) : $($rest)*); + }; + // Munch a token into the current key. (@object $object:ident ($($key:tt)*) $tt:tt $($rest:tt)*) => { json_internal!(@object $object ($($key)* $tt) $($rest)*); diff --git a/json_tests/tests/test.rs b/json_tests/tests/test.rs index 2b0ec48..5d7befc 100644 --- a/json_tests/tests/test.rs +++ b/json_tests/tests/test.rs @@ -1,3 +1,5 @@ +#![cfg_attr(feature = "cargo-clippy", allow(float_cmp))] + #![cfg_attr(feature = "trace-macros", feature(trace_macros))] #[cfg(feature = "trace-macros")] trace_macros!(true); @@ -1006,8 +1008,7 @@ fn test_parse_list() { ("[1, [2, 3]]", (1u64, (2u64, 3u64))), ]); - let v: () = from_str("[]").unwrap(); - assert_eq!(v, ()); + from_str::<()>("[]").unwrap(); } #[test]