diff --git a/src/curr/scval_conversions.rs b/src/curr/scval_conversions.rs index 3eb830ee..6f45e957 100644 --- a/src/curr/scval_conversions.rs +++ b/src/curr/scval_conversions.rs @@ -5,7 +5,7 @@ use super::{ #[cfg(all(not(feature = "std"), feature = "alloc"))] extern crate alloc; #[cfg(all(not(feature = "std"), feature = "alloc"))] -use alloc::{string::String, vec, vec::Vec}; +use alloc::{vec, vec::Vec}; // TODO: Use the Error type for conversions in this file. @@ -300,84 +300,6 @@ impl TryFrom for ScSymbol { } } -#[cfg(feature = "alloc")] -impl TryFrom for ScVal { - type Error = (); - fn try_from(v: String) -> Result { - Ok(ScVal::Symbol(v.try_into().map_err(|()| ())?)) - } -} - -#[cfg(feature = "alloc")] -impl TryFrom<&String> for ScVal { - type Error = (); - fn try_from(v: &String) -> Result { - Ok(ScVal::Symbol(v.try_into().map_err(|()| ())?)) - } -} - -#[cfg(feature = "alloc")] -impl TryFrom for ScSymbol { - type Error = (); - fn try_from(v: String) -> Result { - Ok(ScSymbol(v.try_into().map_err(|_| ())?)) - } -} - -#[cfg(feature = "alloc")] -impl TryFrom<&String> for ScSymbol { - type Error = (); - fn try_from(v: &String) -> Result { - Ok(ScSymbol(v.try_into().map_err(|_| ())?)) - } -} - -#[cfg(feature = "alloc")] -impl TryFrom<&str> for ScVal { - type Error = (); - fn try_from(v: &str) -> Result { - Ok(ScVal::Symbol(v.try_into().map_err(|()| ())?)) - } -} - -#[cfg(not(feature = "alloc"))] -impl TryFrom<&'static str> for ScVal { - type Error = (); - fn try_from(v: &'static str) -> Result { - Ok(ScVal::Symbol(v.try_into().map_err(|()| ())?)) - } -} - -#[cfg(feature = "alloc")] -impl TryFrom<&str> for ScSymbol { - type Error = (); - fn try_from(v: &str) -> Result { - Ok(ScSymbol(v.try_into().map_err(|_| ())?)) - } -} - -#[cfg(not(feature = "alloc"))] -impl TryFrom<&'static str> for ScSymbol { - type Error = (); - fn try_from(v: &'static str) -> Result { - Ok(ScSymbol(v.try_into().map_err(|_| ())?)) - } -} - -#[cfg(feature = "alloc")] -impl TryFrom for String { - type Error = (); - fn try_from(v: ScVal) -> Result { - if let ScVal::Symbol(s) = v { - // TODO: It might be worth distinguishing the error case where this - // is an invalid symbol with invalid characters. - Ok(s.0.into_utf8_string().map_err(|_| ())?) - } else { - Err(()) - } - } -} - #[cfg(feature = "alloc")] impl TryFrom> for ScVal { type Error = ();