From 84ab873b4627558d90c720ac9e03968747627e0e Mon Sep 17 00:00:00 2001 From: Omar Abdulla Date: Thu, 17 Jul 2025 15:33:28 +0300 Subject: [PATCH] Impl new_from for wrapper types --- crates/format/src/macros.rs | 4 ++++ crates/format/src/metadata.rs | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/format/src/macros.rs b/crates/format/src/macros.rs index f3c02a6..ad956a4 100644 --- a/crates/format/src/macros.rs +++ b/crates/format/src/macros.rs @@ -52,6 +52,10 @@ macro_rules! define_wrapper_type { Self(value) } + pub fn new_from>(value: T) -> Self { + Self(value.into()) + } + pub fn into_inner(self) -> $ty { self.0 } diff --git a/crates/format/src/metadata.rs b/crates/format/src/metadata.rs index eb122d3..bae7fc4 100644 --- a/crates/format/src/metadata.rs +++ b/crates/format/src/metadata.rs @@ -191,10 +191,10 @@ impl Metadata { metadata.file_path = Some(path.to_path_buf()); metadata.contracts = Some( [( - ContractAlias::new("test".into()), + ContractAlias::new_from("test"), ContractPathAndIdentifier { contract_source_path: path.to_path_buf(), - contract_ident: ContractIdent::new("Test".into()), + contract_ident: ContractIdent::new_from("Test"), }, )] .into(),