Skip to content

False positive for_kv_map in a consuming loop #1279

Closed
@Riateche

Description

@Riateche
fn main() {
  let c: std::collections::HashMap<i32, String> = Default::default();
  for (_, b) in c {
    println!("{:?}", b);
  }
}

The lint suggests to use values() but AFAIK there is no consuming alternative to values(). (And if it exists, the message should mention it.)

Similar issue: #709.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions