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

option_as_ref_deref doesn't catch fully qualified direct calls to Deref::deref or DerefMut::deref_mut #5927

Closed
Xaeroxe opened this issue Aug 19, 2020 · 0 comments · Fixed by #5933
Labels
C-bug Category: Clippy is not doing the correct thing

Comments

@Xaeroxe
Copy link
Contributor

Xaeroxe commented Aug 19, 2020

I tried this code:

if let Some(value) = value.as_ref().map(std::ops::Deref::deref) {
  //...
}

I expected to see this happen: Lint option_ref_as_deref is triggered and I get redirected to .as_deref()

Instead, this happened: No lint was triggered

Playground for convenience: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=7e8a3b2ac13f0d98a9f79a095b2fd8f2

Meta

  • cargo clippy -V: clippy 0.0.212 (d3fb005 2020-07-31)
  • rustc -Vv:
    rustc 1.45.2 (d3fb005a3 2020-07-31)
    binary: rustc
    commit-hash: d3fb005a39e62501b8b0b356166e515ae24e2e54
    commit-date: 2020-07-31
    host: x86_64-unknown-linux-gnu
    release: 1.45.2
    LLVM version: 10.0
    

Backtrace: N/A, this bug is something not happening when it was expected.

@Xaeroxe Xaeroxe added the C-bug Category: Clippy is not doing the correct thing label Aug 19, 2020
@Xaeroxe Xaeroxe changed the title option_as_ref_deref no longer catches direct calls to Deref::deref or DerefMut::deref_mut option_as_ref_deref doesn't catch fully qualified direct calls to Deref::deref or DerefMut::deref_mut Aug 19, 2020
bors added a commit that referenced this issue Aug 21, 2020
Fix false negative in `option_as_ref_deref`

Closes #5927

changelog: Fix false negative in `option_as_ref_deref`
@bors bors closed this as completed in aa3b04f Aug 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant