-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingC-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesCategory: Enhancement of lints, like adding more cases or adding help messagesgood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy
Description
cargo clippy -V
clippy 0.0.212 (52cebb1 2019-10-15)
Example code
#![warn(clippy::cast_sign_loss)]
fn main() {
let value = i64::min_value().checked_abs().unwrap_or(0) as u64;
assert_eq!(value, 0);
}
Problem
Clippy does warn, that the sign could be lost implicitly, even though it is done explicitly with checked_abs
, which either returns Some(positive i64)
or None
.
Expected behavior
Clippy should ignore this case.
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingC-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesCategory: Enhancement of lints, like adding more cases or adding help messagesgood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy