From 0a8af1aede70c5a0ae6e8ba27d9ee343860c7cae Mon Sep 17 00:00:00 2001 From: Cecile Tonglet Date: Mon, 3 Mar 2025 18:39:28 +0100 Subject: [PATCH] Swap From<&'static str> with From<&str> for IString --- src/string.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/string.rs b/src/string.rs index 14872db..d62ec2d 100644 --- a/src/string.rs +++ b/src/string.rs @@ -69,9 +69,9 @@ impl fmt::Display for IString { } } -impl From<&'static str> for IString { - fn from(s: &'static str) -> IString { - IString::Static(s) +impl From<&str> for IString { + fn from(s: &str) -> IString { + IString::Rc(Rc::from(s)) } } @@ -193,7 +193,7 @@ impl std::borrow::Borrow for IString { impl FromStr for IString { type Err = std::convert::Infallible; fn from_str(value: &str) -> Result { - Ok(IString::from(String::from(value))) + Ok(IString::from(value)) } }