Fix one clippy::unneeded_unwrap warning

This commit is contained in:
Dmitry Bogatov
2019-08-28 00:23:15 +00:00
parent 3d9129c198
commit a6928c29e8

View File

@@ -819,19 +819,21 @@ pub fn dc_msg_get_summarytext_by_raw(
} }
} }
}; };
let ret = if append_text && text.is_some() {
let text = text.unwrap(); if !append_text {
if !prefix.is_empty() { return prefix;
}
if let Some(text) = text {
if prefix.is_empty() {
dc_truncate(text.as_ref(), approx_characters, true).to_string()
} else {
let tmp = format!("{} {}", prefix, text.as_ref()); let tmp = format!("{} {}", prefix, text.as_ref());
dc_truncate(&tmp, approx_characters, true).to_string() dc_truncate(&tmp, approx_characters, true).to_string()
} else {
dc_truncate(text.as_ref(), approx_characters, true).to_string()
} }
} else { } else {
prefix prefix
}; }
ret
} }
pub unsafe fn dc_msg_has_deviating_timestamp(msg: &Message) -> libc::c_int { pub unsafe fn dc_msg_has_deviating_timestamp(msg: &Message) -> libc::c_int {