Open
Description
fn main() {
let x = 3;
assert!(x, 3);
}
This currently gives an error like so:
error[E0308]: mismatched types
--> src/main.rs:3:5
|
3 | assert!(x, 3);
| ^^^^^^^^^^^^^^ expected bool, found integer
|
= note: expected type `bool`
found type `{integer}`
error: aborting due to previous error
If arguments 1 and 2 are the same type, it would be great if we could instead suggest using assert_eq!
instead (preferably with rustfix applicable hint)!
Alternatively we could suggest transforming x, 3
to x == 3
but I guess assert_eq!()
is more idiomatic.
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: Suggestions generated by the compiler applied by `cargo fix`Category: An issue proposing an enhancement or a PR with one.Relevant to the compiler team, which will review and decide on the PR/issue.