conf/accounts: remove some unnecessary unwraps
parent
ed826357a3
commit
9124ad0ae7
|
@ -554,8 +554,8 @@ impl Account {
|
||||||
Some(f.special_usage())
|
Some(f.special_usage())
|
||||||
} else {
|
} else {
|
||||||
let tmp = SpecialUsageMailbox::detect_usage(f.name());
|
let tmp = SpecialUsageMailbox::detect_usage(f.name());
|
||||||
if tmp != Some(SpecialUsageMailbox::Normal) && tmp != None {
|
if let Some(tmp) = tmp.filter(|&v| v != SpecialUsageMailbox::Normal) {
|
||||||
let _ = f.set_special_usage(tmp.unwrap());
|
let _ = f.set_special_usage(tmp);
|
||||||
}
|
}
|
||||||
tmp
|
tmp
|
||||||
};
|
};
|
||||||
|
@ -585,8 +585,8 @@ impl Account {
|
||||||
Some(f.special_usage())
|
Some(f.special_usage())
|
||||||
} else {
|
} else {
|
||||||
let tmp = SpecialUsageMailbox::detect_usage(f.name());
|
let tmp = SpecialUsageMailbox::detect_usage(f.name());
|
||||||
if tmp != Some(SpecialUsageMailbox::Normal) && tmp != None {
|
if let Some(tmp) = tmp.filter(|&v| v != SpecialUsageMailbox::Normal) {
|
||||||
let _ = f.set_special_usage(tmp.unwrap());
|
let _ = f.set_special_usage(tmp);
|
||||||
}
|
}
|
||||||
tmp
|
tmp
|
||||||
};
|
};
|
||||||
|
@ -954,8 +954,7 @@ impl Account {
|
||||||
#[cfg(feature = "sqlite3")]
|
#[cfg(feature = "sqlite3")]
|
||||||
if self.settings.conf.search_backend == crate::conf::SearchBackend::Sqlite3 {
|
if self.settings.conf.search_backend == crate::conf::SearchBackend::Sqlite3 {
|
||||||
if let Err(err) = crate::sqlite3::remove(env_hash) {
|
if let Err(err) = crate::sqlite3::remove(env_hash) {
|
||||||
let envelopes = self.collection.envelopes.read();
|
let envelopes = self.collection.envelopes.read().unwrap();
|
||||||
let envelopes = envelopes.unwrap();
|
|
||||||
melib::log(
|
melib::log(
|
||||||
format!(
|
format!(
|
||||||
"Failed to remove envelope {} [{}] in cache: {}",
|
"Failed to remove envelope {} [{}] in cache: {}",
|
||||||
|
@ -1178,23 +1177,23 @@ impl Account {
|
||||||
self.special_use_mailbox(SpecialUsageMailbox::Inbox),
|
self.special_use_mailbox(SpecialUsageMailbox::Inbox),
|
||||||
self.special_use_mailbox(SpecialUsageMailbox::Normal),
|
self.special_use_mailbox(SpecialUsageMailbox::Normal),
|
||||||
] {
|
] {
|
||||||
if mailbox.is_none() {
|
if let Some(mailbox_hash) = mailbox {
|
||||||
continue;
|
if let Err(e) = self.save(bytes, *mailbox_hash, Some(flags)) {
|
||||||
}
|
debug!("{:?} could not save msg", e);
|
||||||
let mailbox = mailbox.unwrap();
|
melib::log(
|
||||||
if let Err(e) = self.save(bytes, mailbox, Some(flags)) {
|
format!(
|
||||||
debug!("{:?} could not save msg", e);
|
"Could not save in '{}' mailbox: {}.",
|
||||||
melib::log(
|
*mailbox_hash,
|
||||||
format!(
|
e.to_string()
|
||||||
"Could not save in '{}' mailbox: {}.",
|
),
|
||||||
mailbox,
|
melib::ERROR,
|
||||||
e.to_string()
|
);
|
||||||
),
|
} else {
|
||||||
melib::ERROR,
|
saved_at = Some(*mailbox_hash);
|
||||||
);
|
break;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
saved_at = Some(mailbox);
|
continue;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1582,8 +1581,8 @@ impl Account {
|
||||||
)))
|
)))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
if self.active_jobs.contains_key(job_id) {
|
if let Some(mut job) = self.active_jobs.remove(job_id) {
|
||||||
match self.active_jobs.remove(job_id).unwrap() {
|
match job {
|
||||||
JobRequest::Mailboxes { ref mut handle } => {
|
JobRequest::Mailboxes { ref mut handle } => {
|
||||||
if let Ok(Some(mailboxes)) = handle.chan.try_recv() {
|
if let Ok(Some(mailboxes)) = handle.chan.try_recv() {
|
||||||
self.sender
|
self.sender
|
||||||
|
@ -1910,9 +1909,11 @@ impl Account {
|
||||||
let tmp = SpecialUsageMailbox::detect_usage(
|
let tmp = SpecialUsageMailbox::detect_usage(
|
||||||
mailboxes[&mailbox_hash].name(),
|
mailboxes[&mailbox_hash].name(),
|
||||||
);
|
);
|
||||||
if tmp != Some(SpecialUsageMailbox::Normal) && tmp != None {
|
if let Some(tmp) =
|
||||||
|
tmp.filter(|&v| v != SpecialUsageMailbox::Normal)
|
||||||
|
{
|
||||||
mailboxes.entry(mailbox_hash).and_modify(|entry| {
|
mailboxes.entry(mailbox_hash).and_modify(|entry| {
|
||||||
let _ = entry.set_special_usage(tmp.unwrap());
|
let _ = entry.set_special_usage(tmp);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
tmp
|
tmp
|
||||||
|
|
Loading…
Reference in New Issue