Skip to content

Extend incorrect_fn_null_checks lint to useless_ptr_null_checks #113601

Closed
@est31

Description

@est31

I'd suggest extending the newly added incorrect_fn_null_checks lint added in #111717 to cover cases of null comparison for other non-nullable types, like for instance in:

    let v: &u8 = &0;
    (v as *const u8).is_null();

This would involve a renaming of the lint to useless_ptr_null_checks or incorrect_ptr_null_checks. I don't think having multiple lints for different kinds of non-nullable types is useful (one for function pointers, one for references, etc).

See discussion starting from here.

cc @Urgau @scottmcm

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.T-langRelevant to the language team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions