From 1ad45ed4d67a077debce4fa9a2ee1a283f6442db Mon Sep 17 00:00:00 2001 From: holger krekel Date: Sat, 20 Jul 2019 15:14:11 +0200 Subject: [PATCH] fix rust fmt --- src/dc_tools.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/dc_tools.rs b/src/dc_tools.rs index 4e319d09e..2f2039b19 100644 --- a/src/dc_tools.rs +++ b/src/dc_tools.rs @@ -1561,11 +1561,14 @@ pub fn to_string(s: *const libc::c_char) -> String { let cstr = unsafe { CStr::from_ptr(s) }; cstr.to_str().map(|s| s.to_string()).unwrap_or_else(|err| { - panic!("Non utf8 string: '{:?}' ({:?})", cstr.to_string_lossy(), err); + panic!( + "Non utf8 string: '{:?}' ({:?})", + cstr.to_string_lossy(), + err + ); }) } - pub fn to_string_lossy(s: *const libc::c_char) -> String { if s.is_null() { return "".into(); @@ -1573,9 +1576,9 @@ pub fn to_string_lossy(s: *const libc::c_char) -> String { let cstr = unsafe { CStr::from_ptr(s) }; - cstr.to_str().map(|s| s.to_string()).unwrap_or_else(|_| { - cstr.to_string_lossy().to_string() - }) + cstr.to_str() + .map(|s| s.to_string()) + .unwrap_or_else(|_| cstr.to_string_lossy().to_string()) } pub fn as_str<'a>(s: *const libc::c_char) -> &'a str {