Skip to content

Commit 695fc9a

Browse files
authored
Fix new Clippy lints (#1511)
1 parent f5185d9 commit 695fc9a

File tree

7 files changed

+11
-14
lines changed

7 files changed

+11
-14
lines changed

rand_core/src/block.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,10 @@ pub trait CryptoBlockRng: BlockRngCore {}
120120
#[cfg_attr(
121121
feature = "serde",
122122
serde(
123-
bound = "for<'x> R: Serialize + Deserialize<'x> + Sized, for<'x> R::Results: Serialize + Deserialize<'x>"
123+
bound = "for<'x> R: Serialize + Deserialize<'x>, for<'x> R::Results: Serialize + Deserialize<'x>"
124124
)
125125
)]
126-
pub struct BlockRng<R: BlockRngCore + ?Sized> {
126+
pub struct BlockRng<R: BlockRngCore> {
127127
results: R::Results,
128128
index: usize,
129129
/// The *core* part of the RNG, implementing the `generate` function.

rand_distr/src/utils.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,7 @@ pub(crate) fn log_gamma<F: Float>(x: F) -> F {
6767
/// * `pdf`: the probability density function
6868
/// * `zero_case`: manual sampling from the tail when we chose the
6969
/// bottom box (i.e. i == 0)
70-
71-
// the perf improvement (25-50%) is definitely worth the extra code
72-
// size from force-inlining.
73-
#[inline(always)]
70+
#[inline(always)] // Forced inlining improves the perf by 25-50%
7471
pub(crate) fn ziggurat<R: Rng + ?Sized, P, Z>(
7572
rng: &mut R,
7673
symmetric: bool,

src/distr/distribution.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ pub trait Distribution<T> {
110110
}
111111
}
112112

113-
impl<'a, T, D: Distribution<T> + ?Sized> Distribution<T> for &'a D {
113+
impl<T, D: Distribution<T> + ?Sized> Distribution<T> for &D {
114114
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> T {
115115
(*self).sample(rng)
116116
}

src/distr/slice.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ impl std::error::Error for EmptySlice {}
127127
/// Note: the `String` is potentially left with excess capacity; optionally the
128128
/// user may call `string.shrink_to_fit()` afterwards.
129129
#[cfg(feature = "alloc")]
130-
impl<'a> super::DistString for Slice<'a, char> {
130+
impl super::DistString for Slice<'_, char> {
131131
fn append_string<R: crate::Rng + ?Sized>(&self, rng: &mut R, string: &mut String, len: usize) {
132132
// Get the max char length to minimize extra space.
133133
// Limit this check to avoid searching for long slice.

src/distr/uniform.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ where
393393
self
394394
}
395395
}
396-
impl<'a, Borrowed> SampleBorrow<Borrowed> for &'a Borrowed
396+
impl<Borrowed> SampleBorrow<Borrowed> for &Borrowed
397397
where
398398
Borrowed: SampleUniform,
399399
{

src/distr/weighted_index.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ pub struct WeightedIndexIter<'a, X: SampleUniform + PartialOrd> {
256256
index: usize,
257257
}
258258

259-
impl<'a, X> Debug for WeightedIndexIter<'a, X>
259+
impl<X> Debug for WeightedIndexIter<'_, X>
260260
where
261261
X: SampleUniform + PartialOrd + Debug,
262262
X::Sampler: Debug,
@@ -269,7 +269,7 @@ where
269269
}
270270
}
271271

272-
impl<'a, X> Clone for WeightedIndexIter<'a, X>
272+
impl<X> Clone for WeightedIndexIter<'_, X>
273273
where
274274
X: SampleUniform + PartialOrd,
275275
{
@@ -281,7 +281,7 @@ where
281281
}
282282
}
283283

284-
impl<'a, X> Iterator for WeightedIndexIter<'a, X>
284+
impl<X> Iterator for WeightedIndexIter<'_, X>
285285
where
286286
X: for<'b> core::ops::SubAssign<&'b X> + SampleUniform + PartialOrd + Clone,
287287
{

src/seq/index.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ pub enum IndexVecIter<'a> {
153153
U64(slice::Iter<'a, u64>),
154154
}
155155

156-
impl<'a> Iterator for IndexVecIter<'a> {
156+
impl Iterator for IndexVecIter<'_> {
157157
type Item = usize;
158158

159159
#[inline]
@@ -176,7 +176,7 @@ impl<'a> Iterator for IndexVecIter<'a> {
176176
}
177177
}
178178

179-
impl<'a> ExactSizeIterator for IndexVecIter<'a> {}
179+
impl ExactSizeIterator for IndexVecIter<'_> {}
180180

181181
/// Return type of `IndexVec::into_iter`.
182182
#[derive(Clone, Debug)]

0 commit comments

Comments
 (0)