Skip to content

Commit f5cfbc4

Browse files
committed
revert sample_efraimidis_spirakis and fix suggestions
1 parent 1544c72 commit f5cfbc4

File tree

4 files changed

+11
-14
lines changed

4 files changed

+11
-14
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
env:
2424
RUSTDOCFLAGS: --cfg doc_cfg
2525
# --all builds all crates, but with default features for other crates (okay in this case)
26-
run: cargo deadlinks --ignore-fragments -- --all --features nightly,serde1,getrandom,small_rng
26+
run: cargo deadlinks --ignore-fragments -- --all --features nightly,serde1,getrandom,small_rng,min_const_gen
2727

2828
test:
2929
runs-on: ${{ matrix.os }}
@@ -80,8 +80,8 @@ jobs:
8080
- name: Test rand
8181
run: |
8282
cargo test --target ${{ matrix.target }} --lib --tests --no-default-features
83-
cargo build --target ${{ matrix.target }} --no-default-features --features alloc,getrandom,small_rng
84-
cargo test --target ${{ matrix.target }} --lib --tests --no-default-features --features=alloc,getrandom,small_rng
83+
cargo build --target ${{ matrix.target }} --no-default-features --features alloc,getrandom,small_rng,min_const_gen
84+
cargo test --target ${{ matrix.target }} --lib --tests --no-default-features --features=alloc,getrandom,small_rng,min_const_gen
8585
# all stable features:
8686
cargo test --target ${{ matrix.target }} --features=serde1,log,small_rng
8787
cargo test --target ${{ matrix.target }} --examples

src/distributions/other.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ tuple_impl! {A, B, C, D, E, F, G, H, I, J}
189189
tuple_impl! {A, B, C, D, E, F, G, H, I, J, K}
190190
tuple_impl! {A, B, C, D, E, F, G, H, I, J, K, L}
191191

192-
#[cfg_attr(doc_cfg, doc(cfg(feature = "min_const_gen")))]
193192
#[cfg(feature = "min_const_gen")]
193+
#[cfg_attr(doc_cfg, doc(cfg(feature = "min_const_gen")))]
194194
impl<T, const N: usize> Distribution<[T; N]> for Standard
195195
where Standard: Distribution<T>
196196
{

src/distributions/uniform.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,7 +1152,6 @@ mod tests {
11521152
#[test]
11531153
#[cfg(feature = "serde1")]
11541154
fn test_serialization_uniform_duration() {
1155-
use core::time::Duration;
11561155
let distr = UniformDuration::new(Duration::from_secs(10), Duration::from_secs(60));
11571156
let de_distr: UniformDuration = bincode::deserialize(&bincode::serialize(&distr).unwrap()).unwrap();
11581157
assert_eq!(
@@ -1503,8 +1502,6 @@ mod tests {
15031502
#[test]
15041503
#[cfg_attr(miri, ignore)] // Miri is too slow
15051504
fn test_durations() {
1506-
use core::time::Duration;
1507-
15081505
let mut rng = crate::test::rng(253);
15091506

15101507
let v = &[

src/seq/index.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
use alloc::collections::BTreeSet;
1717
#[cfg(feature = "std")] use std::collections::HashSet;
1818

19-
#[cfg(feature = "alloc")]
20-
use crate::distributions::{uniform::SampleUniform, Distribution, Uniform};
2119
#[cfg(feature = "std")]
2220
use crate::distributions::WeightedError;
23-
use crate::Rng;
21+
22+
#[cfg(feature = "alloc")]
23+
use crate::{Rng, distributions::{uniform::SampleUniform, Distribution, Uniform}};
2424

2525
#[cfg(feature = "serde1")]
2626
use serde::{Serialize, Deserialize};
@@ -272,8 +272,8 @@ where R: Rng + ?Sized {
272272
/// `O(length + amount * log length)` time otherwise.
273273
///
274274
/// Panics if `amount > length`.
275-
#[cfg(feature = "alloc")]
276-
#[cfg_attr(doc_cfg, doc(cfg(feature = "alloc")))]
275+
#[cfg(feature = "std")]
276+
#[cfg_attr(doc_cfg, doc(cfg(feature = "std")))]
277277
pub fn sample_weighted<R, F, X>(
278278
rng: &mut R, length: usize, weight: F, amount: usize,
279279
) -> Result<IndexVec, WeightedError>
@@ -305,7 +305,7 @@ where
305305
/// + amount * log length)` time otherwise.
306306
///
307307
/// Panics if `amount > length`.
308-
#[cfg(feature = "alloc")]
308+
#[cfg(feature = "std")]
309309
fn sample_efraimidis_spirakis<R, F, X, N>(
310310
rng: &mut R, length: N, weight: F, amount: N,
311311
) -> Result<IndexVec, WeightedError>
@@ -621,7 +621,7 @@ mod test {
621621
assert_eq!(v1, v2);
622622
}
623623

624-
#[cfg(feature = "alloc")]
624+
#[cfg(feature = "std")]
625625
#[test]
626626
fn test_sample_weighted() {
627627
let seed_rng = crate::test::rng;

0 commit comments

Comments
 (0)