Minimal example:
trait IntoBytes {
fn into_bytes(&self) -> Vec<u8>;
}
impl IntoBytes for u8 {
fn into_bytes(&self) -> Vec<u8> {
vec![*self]
}
}
Here u8 in the trait definition is used as byte, but Clippy suggest to replace u8 with Self which is confusing. I think that this lint shouldn't be triggered for trait implementation.
Whoops. You're right we should only suggest Self if it was Self in the trait declaration.
Most helpful comment
Whoops. You're right we should only suggest
Selfif it wasSelfin the trait declaration.