Skip to content

Improve indexing_slicing help message #2866

@shnewto

Description

@shnewto

The help message reported by the indexing_slicing lint could be improved to be more specific. Currently its reports are relatively generic suggestions, i.e. slicing may panic. Consider using .get(..n) or .get_mut(..n) instead.

It would be useful if we figured out whether get() or get_mut() were the right function to suggest and reported the index/span's actual value. After these changes the above example might look something like slicing may panic. Consider using .get_mut(..3) instead

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesL-suggestionLint: Improving, adding or fixing lint suggestions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions