-
Notifications
You must be signed in to change notification settings - Fork 782
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Lint for sum and product in consensus code (#2226)
## Issue Addressed Closes #1621 ## Proposed Changes Use the `disallowed_method` lint to ban uses of `Iterator::{sum,product}` from `types` and `state_processing`. ## Additional Info The lint is turned off in the tree hash caching code, as it is performance sensitive and overflowy arithmetic is already allowed there.
- Loading branch information
1 parent
668e904
commit a3c482e
Showing
5 changed files
with
13 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Disallow sum and product methods which are prone to overflow. | ||
disallowed-methods = [ | ||
"core::iter::traits::iterator::Iterator::sum", | ||
"core::iter::traits::iterator::Iterator::product", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#![deny(clippy::integer_arithmetic)] | ||
#![deny(clippy::disallowed_method)] | ||
|
||
#[macro_use] | ||
mod macros; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Disallow sum and product methods which are prone to overflow. | ||
disallowed-methods = [ | ||
"core::iter::traits::iterator::Iterator::sum", | ||
"core::iter::traits::iterator::Iterator::product", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters