Skip to content

Commit b736250

Browse files
committed
Use test feature workaround to avoid Redis allocator in tests
1 parent f907c79 commit b736250

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ mod key;
2828
pub use crate::context::Context;
2929
pub use crate::redismodule::*;
3030

31-
#[cfg(not(test))]
31+
/// Ideally this would be `#[cfg(not(test))]`, but that doesn't work:
32+
/// https://github.com/rust-lang/rust/issues/59168#issuecomment-472653680
33+
/// The workaround is to use the `test` feature instead.
34+
#[cfg(not(feature = "test"))]
3235
#[global_allocator]
3336
static ALLOC: crate::alloc::RedisAlloc = crate::alloc::RedisAlloc;
3437

0 commit comments

Comments
 (0)