diff --git a/rnex-core/src/rmc/structures/string_set.rs b/rnex-core/src/rmc/structures/string_set.rs index 9526a4e..f1b4884 100644 --- a/rnex-core/src/rmc/structures/string_set.rs +++ b/rnex-core/src/rmc/structures/string_set.rs @@ -36,13 +36,18 @@ where type Err = Box; fn from_str(s: &str) -> Result { - Ok(Self(s.split("|").map(T::from_str).try_fold( - HashSet::new(), - |mut a, b| -> Result, Self::Err> { - a.insert(b.map_err(Box::new)?); - Ok(a) - }, - )?)) + Ok(Self( + s.split("|") + .filter(|v| !v.is_empty()) + .map(T::from_str) + .try_fold( + HashSet::new(), + |mut a, b| -> Result, Self::Err> { + a.insert(b.map_err(Box::new)?); + Ok(a) + }, + )?, + )) } } @@ -82,5 +87,9 @@ mod test { panic!("sets arent equivalent"); } } + + let _: StringSet = StringSet::from_str("").unwrap(); + + let _: StringSet = StringSet::from_str("10").unwrap(); } }