namada
namada copied to clipboard
core: checked arithmetics
Describe your changes
first part of #2555 addressing core crate
Indicate on which release or other PRs this topic is based on
v0.34.0
Checklist before merging to draft
- [x] I have added a changelog
- [x] Git history is in acceptable state
Codecov Report
Attention: Patch coverage is 79.78385% with 318 lines in your changes are missing coverage. Please review.
Project coverage is 59.53%. Comparing base (
9d4de02) to head (a78ec98). Report is 12 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #3074 +/- ##
==========================================
+ Coverage 59.40% 59.53% +0.12%
==========================================
Files 298 298
Lines 92326 92613 +287
==========================================
+ Hits 54849 55138 +289
+ Misses 37477 37475 -2
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@tzemanovic Is the title of this PR still accurate? Looks like a bunch of crates beyond core are changed. Does this cover everything, everywhere or are there other sections still remaining to transition to checked arithemetic?
@tzemanovic Is the title of this PR still accurate? Looks like a bunch of crates beyond core are changed. Does this cover everything, everywhere or are there other sections still remaining to transition to checked arithemetic?
@cwgoes It is accurate - the lints to warn about unchecked arithmetics and conversions are only applied in the core crate, i.e.:
#![warn(
clippy::cast_sign_loss,
clippy::cast_possible_truncation,
clippy::cast_possible_wrap,
clippy::cast_lossless,
clippy::arithmetic_side_effects
)]
The changes outside of core are only due to removal of unchecked API in core types (except for a few reasonable exceptions), which are extensive but not exhaustive. We should also add these lints to other relevant crates which can still do unchecked arithmetics and conversions with other non-core types.
Understood @tzemanovic - thanks!