-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
A-user-storyArea: A user story or a related issueArea: A user story or a related issue
Description
Lint explanation
Unsigned subtraction is likely to introduce underflow bugs. These bugs won't be caught in release mode.
Example code
Lint should disallow following code
let len: usize = vec.len();
let max_len: usize = 1000;
let available_space = max_len - len; // likely to underflowwhile allowing both
let space = max_len.wrapping/saturating/checked_sub(len)and
let len: isize = vec.len() as i32;
let max_len: isize = 1000;
let space = max_len - len;xFrednet
Metadata
Metadata
Assignees
Labels
A-user-storyArea: A user story or a related issueArea: A user story or a related issue