Skip to content

bad get_unwrap suggestion #3006

Closed
Closed
@isonmad

Description

@isonmad
let v = vec!["a","b"];
let _: Vec<_> = v.get(0..1).unwrap().to_vec();
//              ^^^^^^^^^^^^^^^^^^^^ help: try this: `&v[0..1]`

The suggestion changes the result to &Vec instead of Vec, so it doesn't compile. It has to be v[0..1] or (&v[0..1]) instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingE-mediumCall for participation: Medium difficulty level problem and requires some initial experience.good first issueThese issues are a good way to get started with Clippy

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions