From 2ae5aa429ad6aa2b55bf8ffa42714b81755da2b2 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Mon, 11 Apr 2022 17:47:32 +0200 Subject: [PATCH] Use nih_debug_assert_failure!() in derive macros Instead of nih_log!(). These messages won't appear in release builds. --- nih_plug_derive/src/params.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/nih_plug_derive/src/params.rs b/nih_plug_derive/src/params.rs index 51e6b1de..63737e76 100644 --- a/nih_plug_derive/src/params.rs +++ b/nih_plug_derive/src/params.rs @@ -174,7 +174,11 @@ pub fn derive_params(input: TokenStream) -> TokenStream { serialized.insert(String::from(#persist_key), data); } Err(err) => { - ::nih_plug::nih_log!("Could not serialize '{}': {}", #persist_key, err) + ::nih_plug::nih_debug_assert_failure!( + "Could not serialize '{}': {}", + #persist_key, + err + ) } }; }); @@ -188,7 +192,7 @@ pub fn derive_params(input: TokenStream) -> TokenStream { ); } Err(err) => { - ::nih_plug::nih_log!( + ::nih_plug::nih_debug_assert_failure!( "Could not deserialize '{}': {}", #persist_key, err @@ -267,7 +271,7 @@ pub fn derive_params(input: TokenStream) -> TokenStream { for (field_name, data) in serialized { match field_name.as_str() { #(#field_deserialize_tokens)* - _ => ::nih_plug::nih_log!("Unknown serialized field name: {} (this may not be accurate)", field_name), + _ => ::nih_plug::nih_debug_assert_failure!("Unknown serialized field name: {} (this may not be accurate)", field_name), } }