Closed
Description
This lint was recently added in rust-lang/rust#23630 as part of #803 and it disallows casts such as foo as i64
when foo
has the type i64
.
In theory this does sound like a lint which is nice to have, but I've found that in the context of FFI it's doesn't always play out so well. Because libc::c_int
is simply an alias of some concrete primitive type, it is typically casted out into a known integer to be worked with in Rust. In this specific case the target type of i32
is frequently chosen, triggering this lint. Having to annotate crates with #[allow(trivial_numeric_casts)]
is somewhat annoying for this common use case, and the broader lint (trivial_casts
) seems more relevant to remain as warn-by-default.
cc @nrc
Metadata
Metadata
Assignees
Labels
No labels