-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesCategory: Enhancement of lints, like adding more cases or adding help messagesL-suggestionLint: Improving, adding or fixing lint suggestionsLint: Improving, adding or fixing lint suggestions
Description
pub fn main() {
let x: Option<()> = Some(());
assert_eq!(x.unwrap(), ());
}
Clippy warns here ``assert_eq of unit values detected. This will always succeed
, however this code will actually check and panic if x is None.
Can we suggest to replace it with
assert!(x.is_some())
in this case?
Found in cargo codebase of cargo.
clippy 0.0.212 (5cb9833 2019-10-08)
Metadata
Metadata
Assignees
Labels
C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesCategory: Enhancement of lints, like adding more cases or adding help messagesL-suggestionLint: Improving, adding or fixing lint suggestionsLint: Improving, adding or fixing lint suggestions