Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various refactorings #6041

Merged
merged 4 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/blob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
24 changes: 10 additions & 14 deletions src/chat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -589,20 +589,16 @@ impl ChatId {
timestamp_sort: i64,
contact_id: Option<ContactId>,
) -> 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.
Expand Down
4 changes: 2 additions & 2 deletions src/pgp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ enum SignedPublicKeyOrSubkey<'a> {
Subkey(&'a SignedPublicSubKey),
}

impl<'a> KeyTrait for SignedPublicKeyOrSubkey<'a> {
impl KeyTrait for SignedPublicKeyOrSubkey<'_> {
fn fingerprint(&self) -> Vec<u8> {
match self {
Self::Key(k) => k.fingerprint(),
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/quota.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ async fn get_unique_quota_roots_and_usage(

fn get_highest_usage<'t>(
unique_quota_roots: &'t BTreeMap<String, Vec<QuotaResource>>,
) -> 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 {
Expand Down
Loading