diff --git a/src/blob.rs b/src/blob.rs index 0b53debf4a..43a42850f6 100644 --- a/src/blob.rs +++ b/src/blob.rs @@ -622,7 +622,7 @@ fn exif_orientation(exif: &exif::Exif, context: &Context) -> i32 { 0 } -impl<'a> fmt::Display for BlobObject<'a> { +impl fmt::Display for BlobObject<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "$BLOBDIR/{}", self.name) } diff --git a/src/chat.rs b/src/chat.rs index 7d845c9f6f..f816f6fbd6 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -578,7 +578,7 @@ impl ChatId { Ok(()) } - /// Sets protection and sends or adds a message. + /// Sets protection and adds a message. /// /// `timestamp_sort` is used as the timestamp of the added message /// and should be the timestamp of the change happening. @@ -589,20 +589,16 @@ impl ChatId { timestamp_sort: i64, contact_id: Option, ) -> Result<()> { - match self.inner_set_protection(context, protect).await { - Ok(protection_status_modified) => { - if protection_status_modified { - self.add_protection_msg(context, protect, contact_id, timestamp_sort) - .await?; - chatlist_events::emit_chatlist_item_changed(context, self); - } - Ok(()) - } - Err(e) => { - error!(context, "Cannot set protection: {e:#}."); // make error user-visible - Err(e) - } + let protection_status_modified = self + .inner_set_protection(context, protect) + .await + .with_context(|| format!("Cannot set protection for {self}"))?; + if protection_status_modified { + self.add_protection_msg(context, protect, contact_id, timestamp_sort) + .await?; + chatlist_events::emit_chatlist_item_changed(context, self); } + Ok(()) } /// Sets protection and sends or adds a message. diff --git a/src/pgp.rs b/src/pgp.rs index 364603dfb2..c54ff7a411 100644 --- a/src/pgp.rs +++ b/src/pgp.rs @@ -41,7 +41,7 @@ enum SignedPublicKeyOrSubkey<'a> { Subkey(&'a SignedPublicSubKey), } -impl<'a> KeyTrait for SignedPublicKeyOrSubkey<'a> { +impl KeyTrait for SignedPublicKeyOrSubkey<'_> { fn fingerprint(&self) -> Vec { match self { Self::Key(k) => k.fingerprint(), @@ -64,7 +64,7 @@ impl<'a> KeyTrait for SignedPublicKeyOrSubkey<'a> { } } -impl<'a> PublicKeyTrait for SignedPublicKeyOrSubkey<'a> { +impl PublicKeyTrait for SignedPublicKeyOrSubkey<'_> { fn verify_signature( &self, hash: HashAlgorithm, diff --git a/src/quota.rs b/src/quota.rs index 1710d9da1c..4b874c3dff 100644 --- a/src/quota.rs +++ b/src/quota.rs @@ -73,7 +73,7 @@ async fn get_unique_quota_roots_and_usage( fn get_highest_usage<'t>( unique_quota_roots: &'t BTreeMap>, -) -> Result<(u64, &'t String, &QuotaResource)> { +) -> Result<(u64, &'t String, &'t QuotaResource)> { let mut highest: Option<(u64, &'t String, &QuotaResource)> = None; for (name, resources) in unique_quota_roots { for r in resources {