Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix clippy warnings #1056

Merged
merged 3 commits into from
Dec 4, 2024
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
4 changes: 2 additions & 2 deletions pallets/subtensor/src/epoch/math.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ pub fn check_vec_max_limited(vec: &[u16], max_limit: u16) -> bool {
let mut vec_fixed: Vec<I32F32> = vec.iter().map(|e: &u16| I32F32::from_num(*e)).collect();
inplace_normalize(&mut vec_fixed);
let max_value: Option<&I32F32> = vec_fixed.iter().max();
max_value.map_or(true, |v| *v <= max_limit_fixed)
max_value.is_none_or(|v| *v <= max_limit_fixed)
}

#[allow(dead_code)]
Expand Down Expand Up @@ -1229,7 +1229,7 @@ pub fn mat_ema_alpha_vec(
alpha: &[I32F32],
) -> Vec<Vec<I32F32>> {
// Check if the new matrix is empty or its first row is empty.
if new.is_empty() || new.first().map_or(true, |row| row.is_empty()) {
if new.is_empty() || new.first().is_none_or(|row| row.is_empty()) {
return vec![vec![]; 1];
}

Expand Down
2 changes: 1 addition & 1 deletion support/linting/src/pallet_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl<'ast> syn::visit::Visit<'ast> for ConstructRuntimeVisitor {
.path
.segments
.last()
.map_or(false, |segment| segment.ident == "construct_runtime");
.is_some_and(|segment| segment.ident == "construct_runtime");

if is_construct_runtime {
let tokens = node.mac.tokens.clone();
Expand Down
Loading