mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 14:37:57 +00:00
Clippy arithmetic new (#8282)
* optimize code * fix clippy replace = with += or %= * fix redundant closure found warning * redundant field names in struct initialization * fix clippy warning and optimize code * fix clippy warning * fix clippy warning * fix test error
This commit is contained in:
@@ -307,13 +307,13 @@ where
|
||||
// Round up if the fractional part of the result is non-zero.
|
||||
Rounding::Up => if rem_mul_upper % denom_upper > 0.into() {
|
||||
// `rem * numer / denom` is less than `numer`, so this will not overflow.
|
||||
rem_mul_div_inner = rem_mul_div_inner + 1.into();
|
||||
rem_mul_div_inner += 1.into();
|
||||
},
|
||||
// Round up if the fractional part of the result is greater than a half. An exact half is
|
||||
// rounded down.
|
||||
Rounding::Nearest => if rem_mul_upper % denom_upper > denom_upper / 2.into() {
|
||||
// `rem * numer / denom` is less than `numer`, so this will not overflow.
|
||||
rem_mul_div_inner = rem_mul_div_inner + 1.into();
|
||||
rem_mul_div_inner += 1.into();
|
||||
},
|
||||
}
|
||||
rem_mul_div_inner.into()
|
||||
|
||||
Reference in New Issue
Block a user