mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
1e0b66ef7e
In some cases, removing a cast that looks unnecessary can still change type inference, even when the cast is to the expected same type. The lint now handles casts that flow through intermediate expressions (e.g. calls, blocks, let bindings, loops...). It also treats placeholder generics (e.g. `::<_>`) as inference sensitive. Added regression tests with similar behavior as the original bug, some edge cases and tests to check if false negative cases weren't created. Closes rust-lang/rust-clippy#16449 changelog: [`unnecessary_cast`]: fixed a suggestion to remove a cast that can cause a compilation error if followed.