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

clippy rm allow or_fun_call #907

Merged
merged 3 commits into from
Mar 5, 2025
Merged
Changes from 1 commit
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
7 changes: 4 additions & 3 deletions poly/src/polynomial/univariate/sparse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,16 +253,17 @@ impl<F: Field> SparsePolynomial<F> {
}

/// Perform a naive n^2 multiplication of `self` by `other`.
#[allow(clippy::or_fun_call)]
pub fn mul(&self, other: &Self) -> Self {
if self.is_zero() || other.is_zero() {
SparsePolynomial::zero()
} else {
let mut result = BTreeMap::new();
for (i, self_coeff) in self.coeffs.iter() {
for (j, other_coeff) in other.coeffs.iter() {
let cur_coeff = result.entry(i + j).or_insert(F::zero());
*cur_coeff += &(*self_coeff * other_coeff);
result
.entry(i + j)
.and_modify(|cur_coeff| *cur_coeff += &(*self_coeff * other_coeff))
.or_insert_with(|| *self_coeff * other_coeff);
}
}
SparsePolynomial::from_coefficients_vec(result.into_iter().collect())
Expand Down
Loading