diff --git a/src/macros.rs b/src/macros.rs index 29e16b7..a3accf7 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -161,7 +161,7 @@ macro_rules! json_internal { // Insert the current entry followed by trailing comma. (@object $object:ident [$($key:tt)+] ($value:expr) , $($rest:tt)*) => { - $object.insert(($($key)+).into(), $value); + let _ = $object.insert(($($key)+).into(), $value); json_internal!(@object $object () ($($rest)*) ($($rest)*)); }; @@ -172,7 +172,7 @@ macro_rules! json_internal { // Insert the last entry without trailing comma. (@object $object:ident [$($key:tt)+] ($value:expr)) => { - $object.insert(($($key)+).into(), $value); + let _ = $object.insert(($($key)+).into(), $value); }; // Next value is `null`. diff --git a/tests/test.rs b/tests/test.rs index 4e9c0cc..08d0388 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -1847,6 +1847,9 @@ fn test_json_macro() { ( as Clone>::clone(&Ok("")).unwrap()): "ok", ( as Clone>::clone(&Err("")).unwrap_err()): "err" }); + + #[deny(unused_results)] + let _ = json!({ "architecture": [true, null] }); } #[test]