Skip to content

Lint uses of Vec where arrays would do fine #2262

@clarfonthey

Description

@clarfonthey

For example:

fn something_with_slice<T>(s: &[T]) { ... }

let vals = vec![1, 2];
something_with_slice(&vals);

Bonus points: suggest using ArrayVec when the size is statically guaranteed to be less than a certain amount.

Metadata

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.L-unnecessaryLint: Warn about unnecessary codeT-middleType: Probably requires verifiying types

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions