diff --git a/deltachat-ffi/build.rs b/deltachat-ffi/build.rs index 58e4a2258..0825c1645 100644 --- a/deltachat-ffi/build.rs +++ b/deltachat-ffi/build.rs @@ -19,10 +19,10 @@ fn main() { include_str!("deltachat.pc.in"), name = "deltachat", description = env::var("CARGO_PKG_DESCRIPTION").unwrap(), - url = env::var("CARGO_PKG_HOMEPAGE").unwrap_or("".to_string()), + url = env::var("CARGO_PKG_HOMEPAGE").unwrap_or_else(|_| "".to_string()), version = env::var("CARGO_PKG_VERSION").unwrap(), libs_priv = libs_priv, - prefix = env::var("PREFIX").unwrap_or("/usr/local".to_string()), + prefix = env::var("PREFIX").unwrap_or_else(|_| "/usr/local".to_string()), ); fs::create_dir_all(target_path.join("pkgconfig")).unwrap(); diff --git a/deltachat-ffi/src/lib.rs b/deltachat-ffi/src/lib.rs index 176505e69..8578548f9 100644 --- a/deltachat-ffi/src/lib.rs +++ b/deltachat-ffi/src/lib.rs @@ -487,7 +487,7 @@ pub unsafe extern "C" fn dc_get_next_event(events: *mut dc_event_emitter_t) -> * events .recv_sync() .map(|ev| Box::into_raw(Box::new(ev))) - .unwrap_or_else(|| ptr::null_mut()) + .unwrap_or_else(ptr::null_mut) } #[no_mangle] diff --git a/deltachat-ffi/src/string.rs b/deltachat-ffi/src/string.rs index db9baa7bb..7446e419f 100644 --- a/deltachat-ffi/src/string.rs +++ b/deltachat-ffi/src/string.rs @@ -105,8 +105,9 @@ impl> OsStrExt for T { #[cfg(not(target_os = "windows"))] fn to_c_string(&self) -> Result { use std::os::unix::ffi::OsStrExt; - CString::new(self.as_ref().as_bytes()).map_err(|err| match err { - std::ffi::NulError { .. } => CStringError::InteriorNullByte, + CString::new(self.as_ref().as_bytes()).map_err(|err| { + let std::ffi::NulError { .. } = err; + CStringError::InteriorNullByte }) } @@ -122,8 +123,9 @@ fn os_str_to_c_string_unicode( os_str: &dyn AsRef, ) -> Result { match os_str.as_ref().to_str() { - Some(val) => CString::new(val.as_bytes()).map_err(|err| match err { - std::ffi::NulError { .. } => CStringError::InteriorNullByte, + Some(val) => CString::new(val.as_bytes()).map_err(|err| { + let std::ffi::NulError { .. } = err; + CStringError::InteriorNullByte }), None => Err(CStringError::NotUnicode), }