We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
It suggest &Option<T> instead of Option<&T> or Option<&T::Deref>
&Option<T>
Option<&T>
Option<&T::Deref>
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
No response
The text was updated successfully, but these errors were encountered:
Can definitely be improved. Gonna send a PR.
Sorry, something went wrong.
needless_pass_by_value
GuillaumeGomez
Successfully merging a pull request may close this issue.
Summary
It suggest
&Option<T>
instead ofOption<&T>
orOption<&T::Deref>
Reproducer
I tried this code:
I expected to see this happen:
Instead, this happened:
Additional Labels
No response
The text was updated successfully, but these errors were encountered: