derive_more
derive_more copied to clipboard
Support `Self` in `Into` derive
trafficstars
#[derive(Into)]
pub struct A( [u8; Self::SIZE]);
impl A {
const SIZE: usize = 32;
}
This generates following code:
#[allow(clippy::unused_unit)]
#[automatically_derived]
impl derive_more::core::convert::From<A> for ( [u8; Self::SIZE] ) {
#[inline]
fn from(value: A) -> Self { (<[u8; Self::SIZE] as derive_more::core::convert::From<_>>::from(value.0)) }
}
Which is clearly problematic because for [u8; Self::SIZE] doesn't make sense.
Self in such cases should be replaced with struct name.