-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
I've code that looks something like this:
#[cfg_persistence_derive]
#[derive(Clone)]
#[derive(::educe::Educe)]
#[educe(Debug)
]#[allow(clippy::used_underscore_binding, reason = "Should be educe causing this")]
pub enum ProgressMode {
Batched { size: IPromiseThisIsNonZeroUsize },
}if I cargo-expand this, I get:
#[educe(Debug)]
#[allow(clippy::used_underscore_binding, reason = "Should be educe causing this")]
pub enum ProgressMode {
Batched { size: IPromiseThisIsNonZeroUsize },
}
impl ::core::fmt::Debug for ProgressMode
where
IPromiseThisIsNonZeroUsize: ::core::fmt::Debug,
{
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Batched { size: _size } => {
let mut builder = f.debug_struct("Batched");
builder.field("size", _size);
builder.finish()
}
}
}
}
#[automatically_derived]
#[allow(clippy::used_underscore_binding, reason = "Should be educe causing this")]
impl ::core::clone::Clone for ProgressMode {
#[inline]
fn clone(&self) -> ProgressMode {
match self {
ProgressMode::Batched { size: __self_0 } => {
ProgressMode::Batched {
size: ::core::clone::Clone::clone(__self_0),
}
}
}
}
}as you see, #[derive(Clone) correctly propagates the #[allow] attribute, educe did not.
Because of this, and the was the generated code looks (it does prepend an underscore to variables in some situations) I have no nice way to fix errors caused by disallowing clippy::used_underscore_binding. I have not so nice ones, like disabling that lint globally, or defining all this in a separate module where this lint is allowed, but these seem like hotfixes, not the proper solution, to me.
hadronzoo
Metadata
Metadata
Assignees
Labels
No labels