Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

identity_conversion false positive with ? for loops in 1.35 #4133

Closed
sfackler opened this issue May 23, 2019 · 9 comments
Closed

identity_conversion false positive with ? for loops in 1.35 #4133

sfackler opened this issue May 23, 2019 · 9 comments

Comments

@sfackler
Copy link
Member

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

@hoodie
Copy link

hoodie commented May 23, 2019

ditto: seeing lots of those when I iterare over Result<Vec<_>> with ?

@baumanj
Copy link

baumanj commented May 24, 2019

Seeing this in 1.34 as well

baumanj added a commit to habitat-sh/habitat that referenced this issue May 24, 2019
This only needs to be overridden in a few places, so we do that rather
than remove the lint entirely. These overrides can be removed once
rust-lang/rust-clippy#4133 is resolved

Signed-off-by: Jon Bauman <[email protected]>
stepancheg added a commit to google/starlark-rust that referenced this issue May 27, 2019
@flip1995
Copy link
Member

Yes this is fixed in #4083 and will be available in the next nightly Clippy.

@Manishearth
Copy link
Member

Should we beta backport?

@flip1995
Copy link
Member

I think that would be the right thing to do.

@oli-obk
Copy link
Contributor

oli-obk commented May 28, 2019

@flip1995 that issue link (4083) is not pointing to a PR. I have been unable to find the PR that fixed it.

@flip1995
Copy link
Member

flip1995 commented May 28, 2019

Oh sorry, it was the #4082 PR, the test for this is in #4089

@oli-obk
Copy link
Contributor

oli-obk commented May 28, 2019

I just checked, all of that PR is in the current beta, so we're good

madadam added a commit to madadam/parsec that referenced this issue May 29, 2019
- Some dot files had to be modified/regenerated because the hash of `Observation::Genesis` changed.
- A bogus clippy lint silenced by slightly reshuffling the code (clippy issue: rust-lang/rust-clippy#4133)
madadam added a commit to madadam/parsec that referenced this issue May 29, 2019
- Add a new `genesis_info` parameter to `Parsec::from_genesis` for specifying the related_info on the genesis event.
- Some dot files had to be modified/regenerated because the hash of `Observation::Genesis` changed.
- A bogus clippy lint silenced by slightly reshuffling the code (clippy issue: rust-lang/rust-clippy#4133)
madadam added a commit to madadam/parsec that referenced this issue May 29, 2019
- Add `genesis_related_info` parameter to `Parsec::from_genesis` for specifying the related_info on the genesis event.
- Some dot files had to be modified/regenerated because the hash of `Observation::Genesis` changed.
- A bogus clippy lint silenced by slightly reshuffling the code (clippy issue: rust-lang/rust-clippy#4133)
madadam added a commit to madadam/parsec that referenced this issue May 29, 2019
- Add `genesis_related_info` parameter to `Parsec::from_genesis` for specifying the related_info on the genesis event.
- Some dot files had to be modified/regenerated because the hash of `Observation::Genesis` changed.
- A bogus clippy lint silenced by slightly reshuffling the code (clippy issue: rust-lang/rust-clippy#4133)
baumanj added a commit to habitat-sh/habitat that referenced this issue May 29, 2019
This only needs to be overridden in a few places, so we do that rather
than remove the lint entirely. These overrides can be removed once
rust-lang/rust-clippy#4133 is resolved

Signed-off-by: Jon Bauman <[email protected]>
@wraithan
Copy link

Looks like this is broken on the clippy that comes with stable via rustup component add clippy on rust 1.35.0

[~/devel/rust/shader-playground] master(1)+* ± rustc --version && cargo --version && cargo clippy -- --version
rustc 1.35.0 (3c235d560 2019-05-20)
cargo 1.35.0 (6f3e9c367 2019-04-04)
clippy 0.0.212 (265318db 2019-05-17)
[~/devel/rust/shader-playground] master(1)+* ± cargo clippy
    Checking shader-playground v0.1.0 (/Users/wraithan/devel/rust/shader-playground)
error: identical conversion
   --> src/shader.rs:181:18
    |
181 |     for entry in std::fs::read_dir(dir)? {
    |                  ^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `std::fs::read_dir(dir)?()`: `std::fs::read_dir(dir)?`
    |

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants