diff options
| author | s-ol <s+removethis@s-ol.nu> | 2025-12-16 17:36:57 +0000 |
|---|---|---|
| committer | s-ol <s+removethis@s-ol.nu> | 2025-12-16 17:36:57 +0000 |
| commit | c03281d1f8f856cfc68c2b06dede6b7306b4fea5 (patch) | |
| tree | ee7d10732669bcfb71e9c4ce240c00f8407231fb /src/string_helper.rs | |
| parent | Getting closer to no-std being done (diff) | |
| download | meshcore-rs-main.tar.gz meshcore-rs-main.zip | |
Diffstat (limited to 'src/string_helper.rs')
| -rw-r--r-- | src/string_helper.rs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/string_helper.rs b/src/string_helper.rs index e5af42b..a18bfcd 100644 --- a/src/string_helper.rs +++ b/src/string_helper.rs @@ -1,5 +1,8 @@ #[cfg(not(feature = "std"))] -use arraystring::{ArrayString, typenum::{U32, U160}}; +use arraystring::{ + ArrayString, + typenum::{U32, U160}, +}; #[cfg(feature = "std")] pub(crate) type NameString = String; @@ -8,7 +11,7 @@ pub(crate) type NameString = String; pub(crate) fn name_string_from_slice(s: &[u8]) -> NameString { match String::from_utf8(s.to_vec()) { Ok(s) => s, - Err(_) => "Unable to create string".to_string() + Err(_) => "Unable to create string".to_string(), } } @@ -32,10 +35,8 @@ pub(crate) fn message_string_from_slice(s: &[u8]) -> MessageString { if let Some(s) = split.next() { match String::from_utf8(s.to_vec()) { - Ok(s) => { - s.trim().to_string() - } - Err(_) => "Unable to create string".to_string() + Ok(s) => s.trim().to_string(), + Err(_) => "Unable to create string".to_string(), } } else { "".to_string() @@ -60,7 +61,7 @@ pub(crate) type PasswordString = ArrayString<U160>; pub(crate) fn password_string_from_slice(s: &[u8]) -> PasswordString { match String::from_utf8(s.to_vec()) { Ok(s) => s, - Err(_) => "".to_string() + Err(_) => "".to_string(), } } |
