diff --git a/src/extrema_set.rs b/src/extrema_set.rs index ae128364c..d24114c6d 100644 --- a/src/extrema_set.rs +++ b/src/extrema_set.rs @@ -1,3 +1,5 @@ +#![cfg(feature = "use_alloc")] +use alloc::{vec, vec::Vec}; use std::cmp::Ordering; /// Implementation guts for `min_set`, `min_set_by`, and `min_set_by_key`. diff --git a/src/lib.rs b/src/lib.rs index 458ffe67c..3d5f05c4f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -70,7 +70,6 @@ use std::hash::Hash; use std::iter::{once, IntoIterator}; #[cfg(feature = "use_alloc")] type VecIntoIter = alloc::vec::IntoIter; -#[cfg(feature = "use_alloc")] use std::iter::FromIterator; #[macro_use] @@ -178,7 +177,7 @@ mod diff; #[cfg(feature = "use_std")] mod duplicates_impl; mod exactly_one_err; -#[cfg(feature = "use_std")] +#[cfg(feature = "use_alloc")] mod extrema_set; mod flatten_ok; mod format; @@ -2214,7 +2213,6 @@ pub trait Itertools: Iterator { /// Ok(()) /// } /// ``` - #[cfg(feature = "use_alloc")] fn try_collect(self) -> Result where Self: Sized + Iterator>, @@ -3171,7 +3169,7 @@ pub trait Itertools: Iterator { /// /// The elements can be floats but no particular result is guaranteed /// if an element is NaN. - #[cfg(feature = "use_std")] + #[cfg(feature = "use_alloc")] fn min_set(self) -> Vec where Self: Sized, @@ -3204,7 +3202,7 @@ pub trait Itertools: Iterator { /// /// The elements can be floats but no particular result is guaranteed /// if an element is NaN. - #[cfg(feature = "use_std")] + #[cfg(feature = "use_alloc")] fn min_set_by(self, mut compare: F) -> Vec where Self: Sized, @@ -3236,7 +3234,7 @@ pub trait Itertools: Iterator { /// /// The elements can be floats but no particular result is guaranteed /// if an element is NaN. - #[cfg(feature = "use_std")] + #[cfg(feature = "use_alloc")] fn min_set_by_key(self, key: F) -> Vec where Self: Sized, @@ -3268,7 +3266,7 @@ pub trait Itertools: Iterator { /// /// The elements can be floats but no particular result is guaranteed /// if an element is NaN. - #[cfg(feature = "use_std")] + #[cfg(feature = "use_alloc")] fn max_set(self) -> Vec where Self: Sized, @@ -3301,7 +3299,7 @@ pub trait Itertools: Iterator { /// /// The elements can be floats but no particular result is guaranteed /// if an element is NaN. - #[cfg(feature = "use_std")] + #[cfg(feature = "use_alloc")] fn max_set_by(self, mut compare: F) -> Vec where Self: Sized, @@ -3333,7 +3331,7 @@ pub trait Itertools: Iterator { /// /// The elements can be floats but no particular result is guaranteed /// if an element is NaN. - #[cfg(feature = "use_std")] + #[cfg(feature = "use_alloc")] fn max_set_by_key(self, key: F) -> Vec where Self: Sized,