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

@@ -14,9 +14,9 @@ pub enum ChecksumFunction {
Sha256,
}
impl Into<String> for ChecksumFunction {
fn into(self) -> String {
match self {
impl From<ChecksumFunction> for String {
fn from(from: ChecksumFunction) -> String {
match from {
ChecksumFunction::Sha256 => "sha256".into(),
}
}
@@ -38,8 +38,8 @@ impl TryFrom<String> for ChecksumFunction {
#[serde(try_from = "Value", into = "Value")]
pub struct EmptyMap;
impl Into<Value> for EmptyMap {
fn into(self) -> Value {
impl From<EmptyMap> for Value {
fn from(_from: EmptyMap) -> Value {
Value::Object(Map::default())
}
}

View File

@@ -13,9 +13,9 @@ pub enum CipherFunction {
Aes128Ctr,
}
impl Into<String> for CipherFunction {
fn into(self) -> String {
match self {
impl From<CipherFunction> for String {
fn from(from: CipherFunction) -> String {
match from {
CipherFunction::Aes128Ctr => "aes-128-ctr".into(),
}
}

View File

@@ -25,9 +25,9 @@ impl From<Vec<u8>> for HexBytes {
}
}
impl Into<String> for HexBytes {
fn into(self) -> String {
hex::encode(self.0)
impl From<HexBytes> for String {
fn from(from: HexBytes) -> String {
hex::encode(from.0)
}
}

View File

@@ -23,8 +23,8 @@ pub struct KdfModule {
#[serde(try_from = "String", into = "String")]
pub struct EmptyString;
impl Into<String> for EmptyString {
fn into(self) -> String {
impl From<EmptyString> for String {
fn from(_from: EmptyString) -> String {
"".into()
}
}
@@ -91,9 +91,9 @@ pub enum KdfFunction {
Pbkdf2,
}
impl Into<String> for KdfFunction {
fn into(self) -> String {
match self {
impl From<KdfFunction> for String {
fn from(from: KdfFunction) -> String {
match from {
KdfFunction::Scrypt => "scrypt".into(),
KdfFunction::Pbkdf2 => "pbkdf2".into(),
}