From 1de0f493e8aab7e65ea78e3a079a3de10167c777 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Wed, 28 Aug 2024 15:41:56 +0000 Subject: [PATCH] downgrade deprecation warns into debug_warns Signed-off-by: Jason Volk --- crates/ruma-common/src/api/metadata.rs | 38 ++++++++++++++------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/crates/ruma-common/src/api/metadata.rs b/crates/ruma-common/src/api/metadata.rs index 398b8b46..70f208be 100644 --- a/crates/ruma-common/src/api/metadata.rs +++ b/crates/ruma-common/src/api/metadata.rs @@ -317,30 +317,32 @@ impl VersionHistory { self.removed.expect("VersioningDecision::Removed implies metadata.removed"), )), VersioningDecision::Stable { any_deprecated, all_deprecated, any_removed } => { - if any_removed { - if all_deprecated { - warn!( - "endpoint is removed in some (and deprecated in ALL) \ + if cfg!(debug_assertions) { + if any_removed { + if all_deprecated { + warn!( + "endpoint is removed in some (and deprecated in ALL) \ of the following versions: {versions:?}", + ); + } else if any_deprecated { + warn!( + "endpoint is removed (and deprecated) in some of the \ + following versions: {versions:?}", + ); + } else { + unreachable!("any_removed implies *_deprecated"); + } + } else if all_deprecated { + warn!( + "endpoint is deprecated in ALL of the following versions: \ + {versions:?}", ); } else if any_deprecated { warn!( - "endpoint is removed (and deprecated) in some of the \ - following versions: {versions:?}", + "endpoint is deprecated in some of the following versions: \ + {versions:?}", ); - } else { - unreachable!("any_removed implies *_deprecated"); } - } else if all_deprecated { - warn!( - "endpoint is deprecated in ALL of the following versions: \ - {versions:?}", - ); - } else if any_deprecated { - warn!( - "endpoint is deprecated in some of the following versions: \ - {versions:?}", - ); } Ok(self