Skip to content

unnecessary_cast: core::ffi::c_* cases #13494

@ojeda

Description

@ojeda

Summary

unnecessary_cast's does not cover some cases around core::ffi::c_* types that it could.

Lint Name

unnecessary_cast

Reproducer

I tried this code:

let x = 42;
let _ = x as core::ffi::c_int as core::ffi::c_int;

I expected to see this happen: lint triggers (e.g. "warning: casting to the same type is unnecessary (core::ffi::c_int -> core::ffi::c_int)").

Instead, this happened: lint does not trigger.

Version

rustc 1.83.0-nightly (18b1161 2024-10-02)
binary: rustc
commit-hash: 18b1161
commit-date: 2024-10-02
host: x86_64-unknown-linux-gnu
release: 1.83.0-nightly
LLVM version: 19.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-false-negativeIssue: The lint should have been triggered on code, but wasn't

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions