aboutsummaryrefslogtreecommitdiffstats
path: root/src/string_helper.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/string_helper.rs')
-rw-r--r--src/string_helper.rs15
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(),
}
}