Skip to content

Wrong hint about needless_range_loop #878

Closed
@BusyJay

Description

@BusyJay

Clippy warns about following snippet:

let v = vec![5; 10];
for i in 0..v.len() - 2 {
    println!("{}", v[i + 2] - v[i]);
}

It suggest me to use enumerate. But I don't think I can use enumerate in this situation.

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.I-false-positiveIssue: The lint was triggered on code it shouldn't haveT-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