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

poor suggestion on needless_pass_by_value on Option #13744

Open
dev-ardi opened this issue Nov 28, 2024 · 0 comments
Open

poor suggestion on needless_pass_by_value on Option #13744

dev-ardi opened this issue Nov 28, 2024 · 0 comments
Labels
C-bug Category: Clippy is not doing the correct thing

Comments

@dev-ardi
Copy link

Summary

It suggest &Option<T> instead of Option<&T> or Option<&T::Deref>

Reproducer

I tried this code:

#[allow(unused)]
#[deny(clippy::needless_pass_by_value)]
fn no_consume(x: Option<String>) {}

I expected to see this happen:

help: consider taking a reference instead: `Option<&String>` (or even better, `Option<&str>`)

Instead, this happened:

help: consider taking a reference instead: `&Option<String>`
```1

### Version

```text
rustc 1.84.0-nightly (3fee0f12e 2024-11-20)
binary: rustc
commit-hash: 3fee0f12e4f595948f8f54f57c8b7a7a58127124
commit-date: 2024-11-20
host: x86_64-unknown-linux-gnu
release: 1.84.0-nightly
LLVM version: 19.1.3

Additional Labels

No response

@dev-ardi dev-ardi added the C-bug Category: Clippy is not doing the correct thing label Nov 28, 2024
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

No branches or pull requests

1 participant