Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions rand_chacha/src/guts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ impl ChaCha {
}
}

#[allow(clippy::many_single_char_names)]
#[inline(always)]
fn refill_wide_impl<Mach: Machine>(
m: Mach, state: &mut ChaCha, drounds: u32, out: &mut [u8; BUFSZ],
Expand Down
1 change: 0 additions & 1 deletion rand_core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#![deny(missing_docs)]
#![deny(missing_debug_implementations)]
#![doc(test(attr(allow(unused_variables), deny(warnings))))]
#![allow(clippy::unreadable_literal)]
#![cfg_attr(doc_cfg, feature(doc_cfg))]
#![no_std]

Expand Down
37 changes: 21 additions & 16 deletions rand_distr/src/binomial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use crate::{Distribution, Uniform};
use rand::Rng;
use core::fmt;
use core::cmp::Ordering;

/// The binomial distribution `Binomial(n, p)`.
///
Expand Down Expand Up @@ -210,24 +211,28 @@ impl Distribution<u64> for Binomial {
let s = p / q;
let a = s * (n + 1.);
let mut f = 1.0;
if m < y {
let mut i = m;
loop {
i += 1;
f *= a / (i as f64) - s;
if i == y {
break;
match m.cmp(&y) {
Ordering::Less => {
let mut i = m;
loop {
i += 1;
f *= a / (i as f64) - s;
if i == y {
break;
}
}
}
} else if m > y {
let mut i = y;
loop {
i += 1;
f /= a / (i as f64) - s;
if i == m {
break;
},
Ordering::Greater => {
let mut i = y;
loop {
i += 1;
f /= a / (i as f64) - s;
if i == m {
break;
}
}
}
},
Ordering::Equal => {},
}
if v > f {
continue;
Expand Down
1 change: 1 addition & 0 deletions rand_distr/src/inverse_gaussian.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ where
StandardNormal: Distribution<F>,
Standard: Distribution<F>,
{
#[allow(clippy::many_single_char_names)]
fn sample<R>(&self, rng: &mut R) -> F
where R: Rng + ?Sized {
let mu = self.mean;
Expand Down
6 changes: 3 additions & 3 deletions rand_distr/src/weighted_alias.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ where Uniform<W>: Clone
Self {
aliases: self.aliases.clone(),
no_alias_odds: self.no_alias_odds.clone(),
uniform_index: self.uniform_index.clone(),
uniform_index: self.uniform_index,
uniform_within_weight_sum: self.uniform_within_weight_sum.clone(),
}
}
Expand Down Expand Up @@ -299,7 +299,7 @@ pub trait AliasableWeight:

/// Sums all values in slice `values`.
fn sum(values: &[Self]) -> Self {
values.iter().map(|x| *x).sum()
values.iter().copied().sum()
}
}

Expand All @@ -324,7 +324,7 @@ macro_rules! impl_weight_for_float {
/// rounding errors when there are many floating point values.
fn pairwise_sum<T: AliasableWeight>(values: &[T]) -> T {
if values.len() <= 32 {
values.iter().map(|x| *x).sum()
values.iter().copied().sum()
} else {
let mid = values.len() / 2;
let (a, b) = values.split_at(mid);
Expand Down
1 change: 0 additions & 1 deletion rand_pcg/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
)]
#![deny(missing_docs)]
#![deny(missing_debug_implementations)]
#![allow(clippy::unreadable_literal)]
#![no_std]

#[cfg(not(target_os = "emscripten"))] mod pcg128;
Expand Down
5 changes: 2 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,8 @@
#![cfg_attr(feature = "nightly", feature(slice_partition_at_index))]
#![cfg_attr(doc_cfg, feature(doc_cfg))]
#![allow(
clippy::excessive_precision,
clippy::unreadable_literal,
clippy::float_cmp
clippy::float_cmp,
clippy::neg_cmp_op_on_partial_ord,
)]

#[cfg(feature = "std")] extern crate std;
Expand Down