mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-07 00:42:42 +00:00
Rust 1.79 lints (#5927)
* max_value -> MAX
* remove unnecesary closures
* a couple more max_value -> MAX
* a couple more max_value -> MAX
* Revert "a couple more max_value -> MAX"
This reverts commit 807fe7cae9.
* unused spec field -> phantom data
* ignore some dead code warnings
* update kurtosis repo location
This commit is contained in:
@@ -17,7 +17,7 @@ use std::cmp::max;
|
||||
/// - `list_size == 0`
|
||||
/// - `index >= list_size`
|
||||
/// - `list_size > 2**24`
|
||||
/// - `list_size > usize::max_value() / 2`
|
||||
/// - `list_size > usize::MAX / 2`
|
||||
pub fn compute_shuffled_index(
|
||||
index: usize,
|
||||
list_size: usize,
|
||||
@@ -26,7 +26,7 @@ pub fn compute_shuffled_index(
|
||||
) -> Option<usize> {
|
||||
if list_size == 0
|
||||
|| index >= list_size
|
||||
|| list_size > usize::max_value() / 2
|
||||
|| list_size > usize::MAX / 2
|
||||
|| list_size > 2_usize.pow(24)
|
||||
{
|
||||
return None;
|
||||
@@ -140,7 +140,7 @@ mod tests {
|
||||
fn returns_none_for_too_large_list() {
|
||||
assert_eq!(
|
||||
None,
|
||||
compute_shuffled_index(100, usize::max_value() / 2, &[42, 42], 90)
|
||||
compute_shuffled_index(100, usize::MAX / 2, &[42, 42], 90)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ impl Buf {
|
||||
/// Returns `None` under any of the following conditions:
|
||||
/// - `list_size == 0`
|
||||
/// - `list_size > 2**24`
|
||||
/// - `list_size > usize::max_value() / 2`
|
||||
/// - `list_size > usize::MAX / 2`
|
||||
pub fn shuffle_list(
|
||||
mut input: Vec<usize>,
|
||||
rounds: u8,
|
||||
@@ -84,10 +84,7 @@ pub fn shuffle_list(
|
||||
) -> Option<Vec<usize>> {
|
||||
let list_size = input.len();
|
||||
|
||||
if input.is_empty()
|
||||
|| list_size > usize::max_value() / 2
|
||||
|| list_size > 2_usize.pow(24)
|
||||
|| rounds == 0
|
||||
if input.is_empty() || list_size > usize::MAX / 2 || list_size > 2_usize.pow(24) || rounds == 0
|
||||
{
|
||||
return None;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user