refactor: make get_abs_path non-generic

Generic functions compile into multiple implementations,
increasing number of lines for LLVM to process,
code size and compilation times.
This commit is contained in:
link2xt
2023-09-02 18:17:04 +00:00
parent 9d7bdf369d
commit 49f143e0d5
4 changed files with 21 additions and 21 deletions

View File

@@ -1311,11 +1311,11 @@ impl Chat {
pub async fn get_profile_image(&self, context: &Context) -> Result<Option<PathBuf>> {
if let Some(image_rel) = self.param.get(Param::ProfileImage) {
if !image_rel.is_empty() {
return Ok(Some(get_abs_path(context, image_rel)));
return Ok(Some(get_abs_path(context, Path::new(&image_rel))));
}
} else if self.id.is_archived_link() {
if let Ok(image_rel) = get_archive_icon(context).await {
return Ok(Some(get_abs_path(context, image_rel)));
return Ok(Some(get_abs_path(context, Path::new(&image_rel))));
}
} else if self.typ == Chattype::Single {
let contacts = get_chat_contacts(context, self.id).await?;
@@ -1326,7 +1326,7 @@ impl Chat {
}
} else if self.typ == Chattype::Broadcast {
if let Ok(image_rel) = get_broadcast_icon(context).await {
return Ok(Some(get_abs_path(context, image_rel)));
return Ok(Some(get_abs_path(context, Path::new(&image_rel))));
}
}
Ok(None)