#[derive(EnumVariantType)]
enum Foo<'a> {
NoLifetimeVariant(usize),
LifetimeVariant(&'a str),
}
error[E0392]: parameter `'a` is never used
--> src/main.rs:36:10
|
36 | enum Foo<'a> {
| ^^ unused parameter
|
= help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData`
Seen on v0.3.1
If NoLifetimeVariant is removed or EnumVariantType is removed, the error goes away. I think (though I haven't looked at the library source code or the expanded macro output to make sure) what's happening here is it's trying to give the <'a> to every generated struct, regardless of whether or not it gets used inside that variant.
I understand this may be a difficult thing to solve at the macro level, but I thought I'd report it anyway. In the meantime I'm probably going to work around it using PhantomData
One fix you might be able to implement, which might be easier than inspecting each variant to see if it uses a lifetime, would be to provide an annotation along the lines of #[evt(skip_lifetime('a))] or something that we could manually assign to the problematic variants
Seen on v0.3.1
If
NoLifetimeVariantis removed orEnumVariantTypeis removed, the error goes away. I think (though I haven't looked at the library source code or the expanded macro output to make sure) what's happening here is it's trying to give the<'a>to every generated struct, regardless of whether or not it gets used inside that variant.I understand this may be a difficult thing to solve at the macro level, but I thought I'd report it anyway. In the meantime I'm probably going to work around it using
PhantomDataOne fix you might be able to implement, which might be easier than inspecting each variant to see if it uses a lifetime, would be to provide an annotation along the lines of
#[evt(skip_lifetime('a))]or something that we could manually assign to the problematic variants