You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The underscore binding is used for fields, which should not be used. In my project, I often use PhantomData to store a lifetime. This triggers the clippy::used_underscore_binding lint, when deriving TypedBuilder
Reproducer
#![warn(clippy::used_underscore_binding)]
use std::marker::PhantomData;
use typed_builder::TypedBuilder;
#[derive(TypedBuilder)]
pub struct Bar<'ast> {
#[builder(default)]
_lifetime: PhantomData<&'ast ()>,
}
And run cargo clippy
Suggestions
I'm not sure, if there is a simple way to fix this. Maybe #[allow(clippy::used_underscore_binding)] would fix it. Another option could be the addition of a new #[builder] attribute, that only sets the value and doesn't allow the user to override it.
These are just some suggestions, there are probably better solutions.
The text was updated successfully, but these errors were encountered:
The underscore binding is used for fields, which should not be used. In my project, I often use
PhantomData
to store a lifetime. This triggers theclippy::used_underscore_binding
lint, when derivingTypedBuilder
Reproducer
And run
cargo clippy
Suggestions
I'm not sure, if there is a simple way to fix this. Maybe
#[allow(clippy::used_underscore_binding)]
would fix it. Another option could be the addition of a new#[builder]
attribute, that only sets the value and doesn't allow the user to override it.These are just some suggestions, there are probably better solutions.
The text was updated successfully, but these errors were encountered: