Fix new Clippy lints (#1511)
This commit is contained in:
parent
f5185d91fa
commit
695fc9a5f5
@ -120,10 +120,10 @@ pub trait CryptoBlockRng: BlockRngCore {}
|
|||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "serde",
|
feature = "serde",
|
||||||
serde(
|
serde(
|
||||||
bound = "for<'x> R: Serialize + Deserialize<'x> + Sized, for<'x> R::Results: Serialize + Deserialize<'x>"
|
bound = "for<'x> R: Serialize + Deserialize<'x>, for<'x> R::Results: Serialize + Deserialize<'x>"
|
||||||
)
|
)
|
||||||
)]
|
)]
|
||||||
pub struct BlockRng<R: BlockRngCore + ?Sized> {
|
pub struct BlockRng<R: BlockRngCore> {
|
||||||
results: R::Results,
|
results: R::Results,
|
||||||
index: usize,
|
index: usize,
|
||||||
/// The *core* part of the RNG, implementing the `generate` function.
|
/// The *core* part of the RNG, implementing the `generate` function.
|
||||||
|
@ -67,10 +67,7 @@ pub(crate) fn log_gamma<F: Float>(x: F) -> F {
|
|||||||
/// * `pdf`: the probability density function
|
/// * `pdf`: the probability density function
|
||||||
/// * `zero_case`: manual sampling from the tail when we chose the
|
/// * `zero_case`: manual sampling from the tail when we chose the
|
||||||
/// bottom box (i.e. i == 0)
|
/// bottom box (i.e. i == 0)
|
||||||
|
#[inline(always)] // Forced inlining improves the perf by 25-50%
|
||||||
// the perf improvement (25-50%) is definitely worth the extra code
|
|
||||||
// size from force-inlining.
|
|
||||||
#[inline(always)]
|
|
||||||
pub(crate) fn ziggurat<R: Rng + ?Sized, P, Z>(
|
pub(crate) fn ziggurat<R: Rng + ?Sized, P, Z>(
|
||||||
rng: &mut R,
|
rng: &mut R,
|
||||||
symmetric: bool,
|
symmetric: bool,
|
||||||
|
@ -110,7 +110,7 @@ pub trait Distribution<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T, D: Distribution<T> + ?Sized> Distribution<T> for &'a D {
|
impl<T, D: Distribution<T> + ?Sized> Distribution<T> for &D {
|
||||||
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> T {
|
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> T {
|
||||||
(*self).sample(rng)
|
(*self).sample(rng)
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ impl std::error::Error for EmptySlice {}
|
|||||||
/// Note: the `String` is potentially left with excess capacity; optionally the
|
/// Note: the `String` is potentially left with excess capacity; optionally the
|
||||||
/// user may call `string.shrink_to_fit()` afterwards.
|
/// user may call `string.shrink_to_fit()` afterwards.
|
||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
impl<'a> super::DistString for Slice<'a, char> {
|
impl super::DistString for Slice<'_, char> {
|
||||||
fn append_string<R: crate::Rng + ?Sized>(&self, rng: &mut R, string: &mut String, len: usize) {
|
fn append_string<R: crate::Rng + ?Sized>(&self, rng: &mut R, string: &mut String, len: usize) {
|
||||||
// Get the max char length to minimize extra space.
|
// Get the max char length to minimize extra space.
|
||||||
// Limit this check to avoid searching for long slice.
|
// Limit this check to avoid searching for long slice.
|
||||||
|
@ -393,7 +393,7 @@ where
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl<'a, Borrowed> SampleBorrow<Borrowed> for &'a Borrowed
|
impl<Borrowed> SampleBorrow<Borrowed> for &Borrowed
|
||||||
where
|
where
|
||||||
Borrowed: SampleUniform,
|
Borrowed: SampleUniform,
|
||||||
{
|
{
|
||||||
|
@ -256,7 +256,7 @@ pub struct WeightedIndexIter<'a, X: SampleUniform + PartialOrd> {
|
|||||||
index: usize,
|
index: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, X> Debug for WeightedIndexIter<'a, X>
|
impl<X> Debug for WeightedIndexIter<'_, X>
|
||||||
where
|
where
|
||||||
X: SampleUniform + PartialOrd + Debug,
|
X: SampleUniform + PartialOrd + Debug,
|
||||||
X::Sampler: Debug,
|
X::Sampler: Debug,
|
||||||
@ -269,7 +269,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, X> Clone for WeightedIndexIter<'a, X>
|
impl<X> Clone for WeightedIndexIter<'_, X>
|
||||||
where
|
where
|
||||||
X: SampleUniform + PartialOrd,
|
X: SampleUniform + PartialOrd,
|
||||||
{
|
{
|
||||||
@ -281,7 +281,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, X> Iterator for WeightedIndexIter<'a, X>
|
impl<X> Iterator for WeightedIndexIter<'_, X>
|
||||||
where
|
where
|
||||||
X: for<'b> core::ops::SubAssign<&'b X> + SampleUniform + PartialOrd + Clone,
|
X: for<'b> core::ops::SubAssign<&'b X> + SampleUniform + PartialOrd + Clone,
|
||||||
{
|
{
|
||||||
|
@ -153,7 +153,7 @@ pub enum IndexVecIter<'a> {
|
|||||||
U64(slice::Iter<'a, u64>),
|
U64(slice::Iter<'a, u64>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Iterator for IndexVecIter<'a> {
|
impl Iterator for IndexVecIter<'_> {
|
||||||
type Item = usize;
|
type Item = usize;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
@ -176,7 +176,7 @@ impl<'a> Iterator for IndexVecIter<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> ExactSizeIterator for IndexVecIter<'a> {}
|
impl ExactSizeIterator for IndexVecIter<'_> {}
|
||||||
|
|
||||||
/// Return type of `IndexVec::into_iter`.
|
/// Return type of `IndexVec::into_iter`.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user