mirror of
https://github.com/chatmail/core.git
synced 2026-05-05 22:36:30 +03:00
prefer exhaustive 'match' over 'if'
This commit is contained in:
30
src/blob.rs
30
src/blob.rs
@@ -380,14 +380,13 @@ impl<'a> BlobObject<'a> {
|
|||||||
pub async fn recode_to_avatar_size(&self, context: &Context) -> Result<(), BlobError> {
|
pub async fn recode_to_avatar_size(&self, context: &Context) -> Result<(), BlobError> {
|
||||||
let blob_abs = self.to_abs_path();
|
let blob_abs = self.to_abs_path();
|
||||||
|
|
||||||
let img_wh = if MediaQuality::from_i32(context.get_config_int(Config::MediaQuality).await)
|
let img_wh =
|
||||||
.unwrap_or_default()
|
match MediaQuality::from_i32(context.get_config_int(Config::MediaQuality).await)
|
||||||
== MediaQuality::Balanced
|
.unwrap_or_default()
|
||||||
{
|
{
|
||||||
BALANCED_AVATAR_SIZE
|
MediaQuality::Balanced => BALANCED_AVATAR_SIZE,
|
||||||
} else {
|
MediaQuality::Worse => WORSE_AVATAR_SIZE,
|
||||||
WORSE_AVATAR_SIZE
|
};
|
||||||
};
|
|
||||||
|
|
||||||
self.recode_to_size(context, blob_abs, img_wh).await
|
self.recode_to_size(context, blob_abs, img_wh).await
|
||||||
}
|
}
|
||||||
@@ -400,14 +399,13 @@ impl<'a> BlobObject<'a> {
|
|||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
let img_wh = if MediaQuality::from_i32(context.get_config_int(Config::MediaQuality).await)
|
let img_wh =
|
||||||
.unwrap_or_default()
|
match MediaQuality::from_i32(context.get_config_int(Config::MediaQuality).await)
|
||||||
== MediaQuality::Balanced
|
.unwrap_or_default()
|
||||||
{
|
{
|
||||||
BALANCED_IMAGE_SIZE
|
MediaQuality::Balanced => BALANCED_IMAGE_SIZE,
|
||||||
} else {
|
MediaQuality::Worse => WORSE_IMAGE_SIZE,
|
||||||
WORSE_IMAGE_SIZE
|
};
|
||||||
};
|
|
||||||
|
|
||||||
self.recode_to_size(context, blob_abs, img_wh).await
|
self.recode_to_size(context, blob_abs, img_wh).await
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user