Description
Summary
I believe this might be related to
A user has already commented on that ticket that the fix did not solve the issue for them.
Here's what this looks like:
This screenshot is from an IDE, so you can see the code and the resulting lint error at the same time.
Here's what that looks like in the terminal:
error: it is more idiomatic to use `Option<&T>` instead of `&Option<T>`
--> <redacted>/src/cli/config.rs:15:38
|
15 | #[derive(Debug, Clone, clap::Parser, derive_getters::Getters)]
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ref_option
note: the lint level is defined here
--> <redacted>/src/main.rs:1:22
|
1 | #![deny(clippy::all, clippy::pedantic)]
| ^^^^^^^^^^^^^^^^
= note: `#[deny(clippy::ref_option)]` implied by `#[deny(clippy::pedantic)]`
= note: this error originates in the derive macro `derive_getters::Getters` (in Nightly builds, run with -Z macro-backtrace for more info)
Lint Name
#[deny(clippy::ref_option)]
Reproducer
I tried this code:
#[derive(Debug, Clone, clap::Parser, derive_getters::Getters)]
pub struct Config {
...
}
I saw this happen:
error: it is more idiomatic to use `Option<&T>` instead of `&Option<T>`
--> worker-runner/src/cli/config.rs:15:38
|
15 | #[derive(Debug, Clone, clap::Parser, derive_getters::Getters)]
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ref_option
note: the lint level is defined here
--> worker-runner/src/main.rs:1:22
|
1 | #![deny(clippy::all, clippy::pedantic)]
| ^^^^^^^^^^^^^^^^
= note: `#[deny(clippy::ref_option)]` implied by `#[deny(clippy::pedantic)]`
= note: this error originates in the derive macro `derive_getters::Getters` (in Nightly builds, run with -Z macro-backtrace for more info)
I expected to see this happen:
No error, since the lint is being violated within the code generated by a derive macro. I'd expect there to be a flag to enable checking in an expanded macro (useful for macro authoring). But I'd not expect macro expanded code to be checked by default, as those errors can only be fixed during the development of the macro and only by someone with rights to publish the macro.
Version
rustc 1.83.0 (90b35a623 2024-11-26)
binary: rustc
commit-hash: 90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf
commit-date: 2024-11-26
host: aarch64-apple-darwin
release: 1.83.0
LLVM version: 19.1.1
Additional Labels
No response