Skip to content

identity_conversion false positive with ? for loops in 1.35 #4133

Closed
@sfackler

Description

@sfackler

This may be a duplicate of #4081, but I can't easily check since clippy isn't in the current nightly.

fn foo() -> Result<Vec<u8>, ()> {
    Err(())
}

fn bar() -> Result<(), ()> {
    for _ in foo()? {}

    Ok(())
}
warning: identical conversion
 --> src/main.rs:6:14
  |
6 |     for _ in foo()? {}
  |              ^^^^^^ help: consider removing `foo()?()`: `foo()?`
  |
  = note: #[warn(clippy::identity_conversion)] on by default
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_conversion

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions