chore: change impl Into<T> for U to impl From<U> for T (#5948)

* chore: Change Into trait impl for KzgProof to From trait impl

* chore: change `impl Into <T> for U` to `impl From<U> for T`

* chore: remove `from-over-into` clippy lint exception
This commit is contained in:
kevaundray
2024-06-19 06:02:26 +01:00
committed by GitHub
parent 9f8aa963b1
commit a87f19d801
20 changed files with 120 additions and 121 deletions

View File

@@ -37,9 +37,9 @@ impl From<[u8; GRAFFITI_BYTES_LEN]> for Graffiti {
}
}
impl Into<[u8; GRAFFITI_BYTES_LEN]> for Graffiti {
fn into(self) -> [u8; GRAFFITI_BYTES_LEN] {
self.0
impl From<Graffiti> for [u8; GRAFFITI_BYTES_LEN] {
fn from(from: Graffiti) -> [u8; GRAFFITI_BYTES_LEN] {
from.0
}
}
@@ -77,9 +77,9 @@ impl<'de> Deserialize<'de> for GraffitiString {
}
}
impl Into<Graffiti> for GraffitiString {
fn into(self) -> Graffiti {
let graffiti_bytes = self.0.as_bytes();
impl From<GraffitiString> for Graffiti {
fn from(from: GraffitiString) -> Graffiti {
let graffiti_bytes = from.0.as_bytes();
let mut graffiti = [0; GRAFFITI_BYTES_LEN];
let graffiti_len = std::cmp::min(graffiti_bytes.len(), GRAFFITI_BYTES_LEN);

View File

@@ -77,9 +77,9 @@ impl SelectionProof {
}
}
impl Into<Signature> for SelectionProof {
fn into(self) -> Signature {
self.0
impl From<SelectionProof> for Signature {
fn from(from: SelectionProof) -> Signature {
from.0
}
}

View File

@@ -6,9 +6,9 @@ macro_rules! impl_from_into_u64 {
}
}
impl Into<u64> for $main {
fn into(self) -> u64 {
self.0
impl From<$main> for u64 {
fn from(from: $main) -> u64 {
from.0
}
}
@@ -28,9 +28,9 @@ macro_rules! impl_from_into_usize {
}
}
impl Into<usize> for $main {
fn into(self) -> usize {
self.0 as usize
impl From<$main> for usize {
fn from(from: $main) -> usize {
from.0 as usize
}
}

View File

@@ -150,15 +150,15 @@ impl From<u64> for SubnetId {
}
}
impl Into<u64> for SubnetId {
fn into(self) -> u64 {
self.0
impl From<SubnetId> for u64 {
fn from(from: SubnetId) -> u64 {
from.0
}
}
impl Into<u64> for &SubnetId {
fn into(self) -> u64 {
self.0
impl From<&SubnetId> for u64 {
fn from(from: &SubnetId) -> u64 {
from.0
}
}

View File

@@ -90,9 +90,9 @@ impl SyncSelectionProof {
}
}
impl Into<Signature> for SyncSelectionProof {
fn into(self) -> Signature {
self.0
impl From<SyncSelectionProof> for Signature {
fn from(from: SyncSelectionProof) -> Signature {
from.0
}
}

View File

@@ -78,15 +78,15 @@ impl From<u64> for SyncSubnetId {
}
}
impl Into<u64> for SyncSubnetId {
fn into(self) -> u64 {
self.0
impl From<SyncSubnetId> for u64 {
fn from(from: SyncSubnetId) -> u64 {
from.0
}
}
impl Into<u64> for &SyncSubnetId {
fn into(self) -> u64 {
self.0
impl From<&SyncSubnetId> for u64 {
fn from(from: &SyncSubnetId) -> u64 {
from.0
}
}