1
0
Fork 0
mirror of https://forgejo.ellis.link/continuwuation/continuwuity.git synced 2025-09-30 18:42:05 +00:00

style: Fix clippy lint errors

This commit is contained in:
nexy7574 2025-09-17 23:54:09 +01:00
parent 7f287c7880
commit 0672ce5b88
No known key found for this signature in database
2 changed files with 4 additions and 5 deletions

View file

@ -573,7 +573,7 @@ async fn fix_readreceiptid_readreceipt_duplicates(services: &Services) -> Result
db.db.sort() db.db.sort()
} }
const FIXED_CORRUPT_MSC4133_FIELDS_MARKER: &'static [u8] = b"fix_corrupt_msc4133_fields"; const FIXED_CORRUPT_MSC4133_FIELDS_MARKER: &[u8] = b"fix_corrupt_msc4133_fields";
async fn fix_corrupt_msc4133_fields(services: &Services) -> Result { async fn fix_corrupt_msc4133_fields(services: &Services) -> Result {
use serde_json::{Value, from_slice}; use serde_json::{Value, from_slice};
type KeyVal<'a> = ((OwnedUserId, String), &'a [u8]); type KeyVal<'a> = ((OwnedUserId, String), &'a [u8]);
@ -588,7 +588,7 @@ async fn fix_corrupt_msc4133_fields(services: &Services) -> Result {
.stream() .stream()
.try_fold( .try_fold(
(0_usize, 0_usize), (0_usize, 0_usize),
async |(mut total, mut fixed), async |(total, mut fixed),
((user, key), value): KeyVal<'_>| ((user, key), value): KeyVal<'_>|
-> Result<(usize, usize)> { -> Result<(usize, usize)> {
if let Err(error) = from_slice::<Value>(value) { if let Err(error) = from_slice::<Value>(value) {
@ -607,9 +607,8 @@ async fn fix_corrupt_msc4133_fields(services: &Services) -> Result {
}; };
useridprofilekey_value.put((user, key), new_value); useridprofilekey_value.put((user, key), new_value);
fixed += 1;
} }
total += 1; fixed = total.saturating_add(1);
Ok((total, fixed)) Ok((total, fixed))
}, },

View file

@ -1113,7 +1113,7 @@ impl Service {
.useridprofilekey_value .useridprofilekey_value
.qry(&key) .qry(&key)
.await .await
.and_then(|handle| serde_json::from_slice(&handle).map_err(|err| err.into())) .and_then(|handle| serde_json::from_slice(&handle).map_err(Into::into))
} }
/// Gets all the user's profile keys and values in an iterator /// Gets all the user's profile keys and values in an iterator