Skip to content

Commit

Permalink
Get rid of "partition_add_index" feature
Browse files Browse the repository at this point in the history
It offers nothing over the "nightly" feature and makes testing more
complicated.
  • Loading branch information
vks committed Aug 27, 2020
1 parent cb021c5 commit 03bd82a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
5 changes: 1 addition & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ appveyor = { repository = "rust-random/rand" }
[features]
# Meta-features:
default = ["std", "std_rng"]
nightly = ["simd_support", "partition_at_index"] # enables all features requiring nightly rust
nightly = ["simd_support"] # enables all features requiring nightly rust
serde1 = ["serde"]

# Option (enabled by default): without "std" rand uses libcore; this option
Expand All @@ -45,9 +45,6 @@ std_rng = ["rand_chacha", "rand_hc"]
# Option: enable SmallRng
small_rng = ["rand_pcg"]

# Option (requires nightly): better performance of choose_multiple_weighted
partition_at_index = []

[workspace]
members = [
"rand_core",
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
#![doc(test(attr(allow(unused_variables), deny(warnings))))]
#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(all(feature = "simd_support", feature = "nightly"), feature(stdsimd))]
#![cfg_attr(all(feature = "partition_at_index", feature = "nightly"), feature(slice_partition_at_index))]
#![cfg_attr(feature = "nightly", feature(slice_partition_at_index))]
#![cfg_attr(doc_cfg, feature(doc_cfg))]
#![allow(
clippy::excessive_precision,
Expand Down
8 changes: 4 additions & 4 deletions src/seq/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ where R: Rng + ?Sized {
/// an alternative.
///
/// This implementation uses `O(length + amount)` space and `O(length)` time
/// if the "partition_at_index" feature is enabled, or `O(length)` space and
/// if the "nightly" feature is enabled, or `O(length)` space and
/// `O(length + amount * log length)` time otherwise.
///
/// Panics if `amount > length`.
Expand Down Expand Up @@ -298,7 +298,7 @@ where
/// This implementation uses the algorithm described by Efraimidis and Spirakis
/// in this paper: https://doi.org/10.1016/j.ipl.2005.11.003
/// It uses `O(length + amount)` space and `O(length)` time if the
/// "partition_at_index" feature is enabled, or `O(length)` space and `O(length
/// "nightly" feature is enabled, or `O(length)` space and `O(length
/// + amount * log length)` time otherwise.
///
/// Panics if `amount > length`.
Expand Down Expand Up @@ -342,7 +342,7 @@ where
}
impl<N> Eq for Element<N> {}

#[cfg(feature = "partition_at_index")]
#[cfg(feature = "nightly")]
{
let mut candidates = Vec::with_capacity(length.as_usize());
for index in 0..length.as_usize() {
Expand Down Expand Up @@ -370,7 +370,7 @@ where
Ok(IndexVec::from(result))
}

#[cfg(not(feature = "partition_at_index"))]
#[cfg(not(feature = "nightly"))]
{
#[cfg(all(feature = "alloc", not(feature = "std")))]
use crate::alloc::collections::BinaryHeap;
Expand Down

0 comments on commit 03bd82a

Please sign in to comment.