From 25d7d24d4e802bcc6478582d15c1fade6799ca3f Mon Sep 17 00:00:00 2001 From: Lewis Date: Sun, 19 Jul 2026 17:19:22 +0300 Subject: [PATCH] types: drop unchecked construction from validated newtypes Lewis: May this revision serve well! --- crates/tranquil-types/src/lib.rs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/crates/tranquil-types/src/lib.rs b/crates/tranquil-types/src/lib.rs index d1874f1..f1140eb 100644 --- a/crates/tranquil-types/src/lib.rs +++ b/crates/tranquil-types/src/lib.rs @@ -42,12 +42,6 @@ macro_rules! impl_string_common { } } - impl From for $name { - fn from(s: String) -> Self { - Self(s) - } - } - impl<'a> From<&'a $name> for Cow<'a, str> { fn from(val: &'a $name) -> Self { Cow::Borrowed(&val.0) @@ -109,6 +103,12 @@ macro_rules! simple_string_newtype { } } + impl From for $name { + fn from(s: String) -> Self { + Self(s) + } + } + impl_string_common!($name); }; } @@ -129,6 +129,12 @@ macro_rules! simple_string_newtype_no_sqlx { } } + impl From for $name { + fn from(s: String) -> Self { + Self(s) + } + } + impl_string_common!($name); }; }