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

default_trait_access False Positive with TypedBuilder #6858

Closed
simonsan opened this issue Mar 6, 2021 · 0 comments · Fixed by #8694
Closed

default_trait_access False Positive with TypedBuilder #6858

simonsan opened this issue Mar 6, 2021 · 0 comments · Fixed by #8694
Labels
C-bug Category: Clippy is not doing the correct thing E-medium Call for participation: Medium difficulty level problem and requires some initial experience. I-false-positive Issue: The lint was triggered on code it shouldn't have T-macros Type: Issues with macros and macro expansion

Comments

@simonsan
Copy link

simonsan commented Mar 6, 2021

Lint name:
clippy::default_trait_access

I tried this code:

error: calling `std::option::Option::default()` is more clear than this expression
   --> src\domain\types\api\match_info_response.rs:233:24
    |
233 | #[derive(Clone, Debug, TypedBuilder, PartialEq, Serialize, Deserialize)]
    |                        ^^^^^^^^^^^^
    |
note: the lint level is defined here
   --> src/lib.rs:3:9
    |
3   | #![deny(clippy::pedantic)]
    |         ^^^^^^^^^^^^^^^^
    = note: `#[deny(clippy::default_trait_access)]` implied by `#[deny(clippy::pedantic)]`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#default_trait_access
    = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)

I expected to see this happen:
To not show up

Instead, this happened: See above

Meta

Using cargo +nightly clippy

  • cargo clippy -V: clippy 0.1.52 (45b3c28 2021-03-04)
  • rustc -Vv:
    rustc 1.52.0-nightly (45b3c2851 2021-03-04)
    binary: rustc
    commit-hash: 45b3c28518e4c45dfd12bc2c4400c0d0e9639927
    commit-date: 2021-03-04
    host: x86_64-pc-windows-msvc
    release: 1.52.0-nightly
    LLVM version: 12.0.0
    
@simonsan simonsan added C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have labels Mar 6, 2021
@camsteffen camsteffen added E-medium Call for participation: Medium difficulty level problem and requires some initial experience. T-macros Type: Issues with macros and macro expansion labels Mar 29, 2021
bors added a commit that referenced this issue Aug 8, 2022
More proc-macro detection

fixes #6514
fixes #8683
fixes #6858
fixes #6594

This is a more general way of checking if an expression comes from a macro and could be trivially applied to other lints. Ideally this would be fixed in rustc's proc-macro api, but I don't see that happening any time soon.

changelog: Don't lint `unit_arg` when generated by a proc-macro.
@bors bors closed this as completed in 10853f7 Aug 8, 2022
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 E-medium Call for participation: Medium difficulty level problem and requires some initial experience. I-false-positive Issue: The lint was triggered on code it shouldn't have T-macros Type: Issues with macros and macro expansion
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants