Skip to content

Consequences of ptr_arg #846

Open
Open

Description

Currently, following ptr_arg can lead to errors, if

  • the function is used as a Fn reference (fn foo(&Vec<u8>) { .. }; let foo : Fn(&Vec<u8>) = foo)
  • the function calls another function that expects a &Vec reference.

We could extend the lint to

  • check the whole crate if the function is referenced anywhere (we obviously cannot check across crate boundaries, but I guess, that'll be OK.
  • look into the function and check the signatures of the contained calls; if those are only functions within the crate, note if those are eligible for ptr_arg, otherwise don't lint. We should also bail on out-of-crate functions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesE-mediumCall for participation: Medium difficulty level problem and requires some initial experience.T-ASTType: Requires working with the AST

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions