diff --git a/mmime/src/charconv.rs b/mmime/src/charconv.rs index d6394b713..d44785b72 100644 --- a/mmime/src/charconv.rs +++ b/mmime/src/charconv.rs @@ -16,9 +16,12 @@ pub unsafe fn charconv( ) -> libc::c_int { assert!(!fromcode.is_null(), "invalid fromcode"); assert!(!s.is_null(), "invalid input string"); - if let Some(encoding) = - charset::Charset::for_label(CStr::from_ptr(fromcode).to_str().unwrap_or_default().as_bytes()) - { + if let Some(encoding) = charset::Charset::for_label( + CStr::from_ptr(fromcode) + .to_str() + .unwrap_or_default() + .as_bytes(), + ) { let data = std::slice::from_raw_parts(s as *const u8, strlen(s)); let (res, _, _) = encoding.decode(data); diff --git a/src/aheader.rs b/src/aheader.rs index 5cba48aa9..fc5f6ccc6 100644 --- a/src/aheader.rs +++ b/src/aheader.rs @@ -79,8 +79,11 @@ impl Aheader { let optional_field = unsafe { (*field).fld_data.fld_optional_field }; if !optional_field.is_null() && unsafe { !(*optional_field).fld_name.is_null() } - && unsafe { CStr::from_ptr((*optional_field).fld_name).to_str().unwrap_or_default() } - == "Autocrypt" + && unsafe { + CStr::from_ptr((*optional_field).fld_name) + .to_str() + .unwrap_or_default() + } == "Autocrypt" { let value = unsafe { CStr::from_ptr((*optional_field).fld_value) diff --git a/src/chatlist.rs b/src/chatlist.rs index a89bb11bb..7900f6ea7 100644 --- a/src/chatlist.rs +++ b/src/chatlist.rs @@ -290,7 +290,12 @@ impl Chatlist { { ret.text2 = Some(context.stock_str(StockMessage::NoMessages).to_string()); } else { - ret.fill(&mut lastmsg.unwrap_or_default(), chat, lastcontact.as_ref(), context); + ret.fill( + &mut lastmsg.unwrap_or_default(), + chat, + lastcontact.as_ref(), + context, + ); } ret diff --git a/src/config.rs b/src/config.rs index 0d5b14da4..5fdd3eb1e 100644 --- a/src/config.rs +++ b/src/config.rs @@ -79,7 +79,12 @@ impl Context { let value = match key { Config::Selfavatar => { let rel_path = self.sql.get_raw_config(self, key); - rel_path.map(|p| dc_get_abs_path(self, &p).to_str().unwrap_or_default().to_string()) + rel_path.map(|p| { + dc_get_abs_path(self, &p) + .to_str() + .unwrap_or_default() + .to_string() + }) } Config::SysVersion => Some((&*DC_VERSION_STR).clone()), Config::SysMsgsizeMaxRecommended => Some(format!("{}", 24 * 1024 * 1024 / 4 * 3)), diff --git a/src/dc_mimeparser.rs b/src/dc_mimeparser.rs index 4bbe2d896..16d03f095 100644 --- a/src/dc_mimeparser.rs +++ b/src/dc_mimeparser.rs @@ -620,9 +620,12 @@ impl<'a> MimeParser<'a> { && strcmp(charset, b"utf-8\x00" as *const u8 as *const libc::c_char) != 0i32 && strcmp(charset, b"UTF-8\x00" as *const u8 as *const libc::c_char) != 0i32 { - if let Some(encoding) = - Charset::for_label(CStr::from_ptr(charset).to_str().unwrap_or_default().as_bytes()) - { + if let Some(encoding) = Charset::for_label( + CStr::from_ptr(charset) + .to_str() + .unwrap_or_default() + .as_bytes(), + ) { let (res, _, _) = encoding.decode(&decoded_data); if res.is_empty() { /* no error - but nothing to add */ diff --git a/src/dc_tools.rs b/src/dc_tools.rs index 4d882936d..ff1103de6 100644 --- a/src/dc_tools.rs +++ b/src/dc_tools.rs @@ -637,7 +637,10 @@ fn dc_make_rel_path(context: &Context, path: &mut String) { .map(|s| path.starts_with(s)) .unwrap_or_default() { - *path = path.replace(context.get_blobdir().to_str().unwrap_or_default(), "$BLOBDIR"); + *path = path.replace( + context.get_blobdir().to_str().unwrap_or_default(), + "$BLOBDIR", + ); } } diff --git a/src/e2ee.rs b/src/e2ee.rs index e95cbe4e0..c4e3515c6 100644 --- a/src/e2ee.rs +++ b/src/e2ee.rs @@ -47,7 +47,8 @@ pub struct EncryptHelper { impl EncryptHelper { pub fn new(context: &Context) -> Result { let prefer_encrypt = - EncryptPreference::from_i32(context.get_config_int(Config::E2eeEnabled)).unwrap_or_default(); + EncryptPreference::from_i32(context.get_config_int(Config::E2eeEnabled)) + .unwrap_or_default(); let addr = match context.get_config(Config::ConfiguredAddr) { None => { bail!("addr not configured!"); diff --git a/src/imap.rs b/src/imap.rs index 32115e2a3..bdd54e506 100644 --- a/src/imap.rs +++ b/src/imap.rs @@ -697,8 +697,16 @@ impl Imap { // the entry has the format `imap.mailbox.=:` let mut parts = entry.split(':'); ( - parts.next().unwrap_or_default().parse().unwrap_or_else(|_| 0), - parts.next().unwrap_or_default().parse().unwrap_or_else(|_| 0), + parts + .next() + .unwrap_or_default() + .parse() + .unwrap_or_else(|_| 0), + parts + .next() + .unwrap_or_default() + .parse() + .unwrap_or_else(|_| 0), ) } else { (0, 0) @@ -752,7 +760,12 @@ impl Imap { // id we do not do this here, we'll miss the first message // as we will get in here again and fetch from lastseenuid+1 then - self.set_config_last_seen_uid(context, &folder, mailbox.uid_validity.unwrap_or_default(), 0); + self.set_config_last_seen_uid( + context, + &folder, + mailbox.uid_validity.unwrap_or_default(), + 0, + ); return 0; } @@ -1056,13 +1069,14 @@ impl Imap { let mut do_fake_idle = true; while do_fake_idle { // wait a moment: every 5 seconds in the first 3 minutes after a new message, after that every 60 seconds. - let seconds_to_wait = - if fake_idle_start_time.elapsed().unwrap_or_default() < Duration::new(3 * 60, 0) && !wait_long - { - Duration::new(5, 0) - } else { - Duration::new(60, 0) - }; + let seconds_to_wait = if fake_idle_start_time.elapsed().unwrap_or_default() + < Duration::new(3 * 60, 0) + && !wait_long + { + Duration::new(5, 0) + } else { + Duration::new(60, 0) + }; let &(ref lock, ref cvar) = &*self.watch.clone(); let mut watch = lock.lock().unwrap(); diff --git a/src/securejoin.rs b/src/securejoin.rs index bb99fd9a6..4aa0cf100 100644 --- a/src/securejoin.rs +++ b/src/securejoin.rs @@ -675,7 +675,9 @@ fn mark_peer_as_verified(context: &Context, fingerprint: impl AsRef) -> Res if peerstate.set_verified(1, fingerprint.as_ref(), 2) { peerstate.prefer_encrypt = EncryptPreference::Mutual; peerstate.to_save = Some(ToSave::All); - peerstate.save_to_db(&context.sql, false).unwrap_or_default(); + peerstate + .save_to_db(&context.sql, false) + .unwrap_or_default(); return Ok(()); } } diff --git a/src/smtp.rs b/src/smtp.rs index 377f4b16a..9643a583a 100644 --- a/src/smtp.rs +++ b/src/smtp.rs @@ -81,7 +81,10 @@ impl Smtp { } let user = &lp.send_user; - lettre::smtp::authentication::Credentials::new(user.to_string(), access_token.unwrap_or_default()) + lettre::smtp::authentication::Credentials::new( + user.to_string(), + access_token.unwrap_or_default(), + ) } else { // plain let user = lp.send_user.clone();