Skip to content

Commit d02f166

Browse files
committed
Restrict panic testing to when std is enabled
1 parent 33b7461 commit d02f166

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/lib.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -438,10 +438,12 @@ fn clamp_test() {
438438

439439
#[test]
440440
fn clamp_nan_bound() {
441-
/// When debug assertions are enabled, checks that the expression panics.
441+
/// When debug assertions and the `std` feature are enabled, checks that
442+
/// the expression panics.
442443
macro_rules! assert_debug_panics {
443444
($body:expr) => {
444-
if cfg!(debug_assertions) {
445+
#[cfg(all(debug_assertions, feature = "std"))]
446+
{
445447
if let Ok(v) = ::std::panic::catch_unwind(|| $body) {
446448
panic!(
447449
"assertion failed: should_panic; non-panicking result: {:?}",

0 commit comments

Comments
 (0)