Skip to content

fix: clippy::wrong_self_convention warning for fields with is_ prefix etc.#349

Merged
Veetaha merged 1 commit intoelastio:masterfrom
nicmue:master
Oct 8, 2025
Merged

fix: clippy::wrong_self_convention warning for fields with is_ prefix etc.#349
Veetaha merged 1 commit intoelastio:masterfrom
nicmue:master

Conversation

@nicmue
Copy link
Copy Markdown
Contributor

@nicmue nicmue commented Oct 8, 2025

When having a field which has one of the prefixes listed by clippy::wrong_self_convention you will end up getting said lint warning in your bon::Builder macro:

#[derive(Builder)]
struct Unique {
    is_unique: bool,
}
warning: methods called `is_*` usually take `self` by mutable reference or `self` by reference or no `self`
 --> src/main.rs:7:10
  |
7 | #[derive(Builder)]
  |          ^^^^^^^
  |
  = help: consider choosing a less ambiguous name
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#wrong_self_convention
  = note: `#[warn(clippy::wrong_self_convention)]` on by default
  = note: this warning originates in the derive macro `Builder` (in Nightly builds, run with -Z macro-backtrace for more info)

This PR proposes to add #[allow(clippy::wrong_self_convention)] to all generated setters to avoid this lint warning entirely.

Copy link
Copy Markdown
Collaborator

@Veetaha Veetaha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, thanks! I'll make a patch

@Veetaha Veetaha merged commit ed84aa0 into elastio:master Oct 8, 2025
34 of 36 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 8, 2025
@Veetaha
Copy link
Copy Markdown
Collaborator

Veetaha commented Oct 8, 2025

Released in 3.8.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants