mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-18 08:11:24 +01:00
enable map_unwrap_or lint
This commit is contained in:
parent
645d88177a
commit
224ba65d06
10 changed files with 81 additions and 73 deletions
|
|
@ -276,7 +276,7 @@ lasttimelinecount_cache: {lasttimelinecount_cache}\n"
|
|||
);
|
||||
tree
|
||||
})
|
||||
.unwrap_or_else(BTreeMap::new);
|
||||
.unwrap_or_default();
|
||||
|
||||
Ok(signingkeys)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,11 +31,10 @@ impl service::rooms::user::Data for KeyValueDatabase {
|
|||
|
||||
self.userroomid_notificationcount
|
||||
.get(&userroom_id)?
|
||||
.map(|bytes| {
|
||||
.map_or(Ok(0), |bytes| {
|
||||
utils::u64_from_bytes(&bytes)
|
||||
.map_err(|_| Error::bad_database("Invalid notification count in db."))
|
||||
})
|
||||
.unwrap_or(Ok(0))
|
||||
}
|
||||
|
||||
fn highlight_count(&self, user_id: &UserId, room_id: &RoomId) -> Result<u64> {
|
||||
|
|
@ -45,11 +44,10 @@ impl service::rooms::user::Data for KeyValueDatabase {
|
|||
|
||||
self.userroomid_highlightcount
|
||||
.get(&userroom_id)?
|
||||
.map(|bytes| {
|
||||
.map_or(Ok(0), |bytes| {
|
||||
utils::u64_from_bytes(&bytes)
|
||||
.map_err(|_| Error::bad_database("Invalid highlight count in db."))
|
||||
})
|
||||
.unwrap_or(Ok(0))
|
||||
}
|
||||
|
||||
fn last_notification_read(&self, user_id: &UserId, room_id: &RoomId) -> Result<u64> {
|
||||
|
|
|
|||
|
|
@ -348,12 +348,11 @@ impl service::users::Data for KeyValueDatabase {
|
|||
fn last_one_time_keys_update(&self, user_id: &UserId) -> Result<u64> {
|
||||
self.userid_lastonetimekeyupdate
|
||||
.get(user_id.as_bytes())?
|
||||
.map(|bytes| {
|
||||
.map_or(Ok(0), |bytes| {
|
||||
utils::u64_from_bytes(&bytes).map_err(|_| {
|
||||
Error::bad_database("Count in roomid_lastroomactiveupdate is invalid.")
|
||||
})
|
||||
})
|
||||
.unwrap_or(Ok(0))
|
||||
}
|
||||
|
||||
fn take_one_time_key(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue