diff --git a/src/core/pdu/mod.rs b/src/core/pdu/mod.rs index ba1d2ce1..1a8f6a70 100644 --- a/src/core/pdu/mod.rs +++ b/src/core/pdu/mod.rs @@ -9,6 +9,7 @@ mod raw_id; mod redact; mod relation; mod strip; +#[cfg(test)] mod tests; mod unsigned; diff --git a/src/core/pdu/tests.rs b/src/core/pdu/tests.rs index ae3b1dd6..ed9b7caa 100644 --- a/src/core/pdu/tests.rs +++ b/src/core/pdu/tests.rs @@ -1,5 +1,3 @@ -#![cfg(test)] - use super::Count; #[test] diff --git a/src/core/utils/mod.rs b/src/core/utils/mod.rs index 16072765..631b2820 100644 --- a/src/core/utils/mod.rs +++ b/src/core/utils/mod.rs @@ -16,6 +16,7 @@ pub mod set; pub mod stream; pub mod string; pub mod sys; +#[cfg(test)] mod tests; pub mod time; diff --git a/src/core/utils/tests.rs b/src/core/utils/tests.rs index 5c870730..1bcb92b8 100644 --- a/src/core/utils/tests.rs +++ b/src/core/utils/tests.rs @@ -1,4 +1,3 @@ -#![cfg(test)] #![allow(clippy::disallowed_methods)] use crate::utils; diff --git a/src/database/mod.rs b/src/database/mod.rs index 183cba8d..bdb7d3ea 100644 --- a/src/database/mod.rs +++ b/src/database/mod.rs @@ -11,6 +11,7 @@ mod opts; mod pool; mod ser; mod stream; +#[cfg(test)] mod tests; pub(crate) mod util; mod watchers; diff --git a/src/database/tests.rs b/src/database/tests.rs index 3d41a544..0c9fb41a 100644 --- a/src/database/tests.rs +++ b/src/database/tests.rs @@ -1,4 +1,3 @@ -#![cfg(test)] #![allow(clippy::needless_borrows_for_generic_args)] use std::fmt::Debug; @@ -14,7 +13,7 @@ use crate::{ }; #[test] -#[should_panic(expected = "serializing string at the top-level")] +#[cfg_attr(debug_assertions, should_panic(expected = "serializing string at the top-level"))] fn ser_str() { let user_id: &UserId = "@user:example.com".try_into().unwrap(); let s = serialize_to_vec(&user_id).expect("failed to serialize user_id"); @@ -139,7 +138,7 @@ fn ser_json_macro() { } #[test] -#[should_panic(expected = "serializing string at the top-level")] +#[cfg_attr(debug_assertions, should_panic(expected = "serializing string at the top-level"))] fn ser_json_raw() { use conduwuit::ruma::api::client::filter::FilterDefinition; @@ -156,7 +155,7 @@ fn ser_json_raw() { } #[test] -#[should_panic(expected = "you can skip serialization instead")] +#[cfg_attr(debug_assertions, should_panic(expected = "you can skip serialization instead"))] fn ser_json_raw_json() { use conduwuit::ruma::api::client::filter::FilterDefinition;