Skip to content

Commit 4ba1cfc

Browse files
committed
Fix alloc feature
1 parent ee2853e commit 4ba1cfc

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/iter.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ impl<'a, R:?Sized+'a, U, F> Iterator for FlatMap<'a, R, U, F>
195195
mod tests {
196196
use {Rng, RngCore};
197197
use distributions::{Uniform};
198-
#[cfg(features="alloc")] use alloc::{Vec, String};
198+
#[cfg(all(not(feature="std"), feature="alloc"))] use alloc::{Vec, String};
199199

200200
#[test]
201201
#[cfg(any(feature="std", feature="alloc"))]

src/lib.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@
252252
#![cfg_attr(all(target_arch = "wasm32", not(target_os = "emscripten")), recursion_limit="128")]
253253

254254
#[cfg(feature="std")] extern crate std as core;
255-
#[cfg(all(feature = "alloc", not(feature="std")))] extern crate alloc;
255+
#[cfg(all(feature = "alloc", not(feature="std")))] #[macro_use] extern crate alloc;
256256

257257
#[cfg(test)] #[cfg(feature="serde-1")] extern crate bincode;
258258
#[cfg(feature="serde-1")] extern crate serde;
@@ -1128,8 +1128,7 @@ pub fn sample<T, I, R>(rng: &mut R, iterable: I, amount: usize) -> Vec<T>
11281128
mod test {
11291129
use mock::StepRng;
11301130
use super::*;
1131-
#[cfg(feature="alloc")]
1132-
use alloc::boxed::Box;
1131+
#[cfg(all(not(feature="std"), feature="alloc"))] use alloc::boxed::Box;
11331132

11341133
pub struct TestRng<R> { inner: R }
11351134

0 commit comments

Comments
 (0)