Skip to content

Commit

Permalink
Deny overflowing (and lossy) integer type cast operations (#1895)
Browse files Browse the repository at this point in the history
* Deny overflowing (and lossy) integer type cast operations

* Update docs
  • Loading branch information
davidsemakula authored Jan 23, 2025
1 parent 712c3ab commit ea745c0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

[Unreleased]

### Added
- Deny overflowing (and lossy) integer type cast operations - [#1895](https://github.com/use-ink/cargo-contract/pull/1895)

### Changed
- Target `pallet-revive` instead of `pallet-contracts` - [#1851](https://github.com/use-ink/cargo-contract/pull/1851)

Expand Down
9 changes: 7 additions & 2 deletions crates/build/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,9 +504,14 @@ fn exec_cargo_clippy(crate_metadata: &CrateMetadata, verbosity: Verbosity) -> Re
"--all-features",
// customize clippy lints after the "--"
"--",
// this is a hard error because we want to guarantee that implicit overflows
// never happen
// these are hard errors because we want to guarantee that implicit overflows
// and lossy integer conversions never happen
// See https://github.com/use-ink/cargo-contract/pull/1190
"-Dclippy::arithmetic_side_effects",
// See https://github.com/use-ink/cargo-contract/pull/1895
"-Dclippy::cast_possible_truncation",
"-Dclippy::cast_possible_wrap",
"-Dclippy::cast_sign_loss",
];
// we execute clippy with the plain manifest no temp dir required
execute_cargo(util::cargo_cmd(
Expand Down

0 comments on commit ea745c0

Please sign in to comment.