refactor: appease clippy

This commit is contained in:
Matthias Ahouansou 2024-02-16 21:13:59 +00:00
parent d841b81c56
commit 4c06f329c4
3 changed files with 12 additions and 6 deletions

View File

@ -1618,7 +1618,7 @@ pub async fn sync_events_v4_route(
.rooms
.state_accessor
.get_name(room_id)?
.or_else(|| name),
.or(name),
avatar: if let Some(avatar) = avatar {
ruma::JsOption::Some(avatar)
} else {

View File

@ -966,14 +966,21 @@ impl Service {
debug!("Resolving state");
let lock = services().globals.stateres_mutex.lock();
let state = match state_res::resolve(room_version_id, &fork_states, auth_chain_sets, |id| {
let fetch_event = |id: &_| {
let res = services().rooms.timeline.get_pdu(id);
if let Err(e) = &res {
error!("LOOK AT ME Failed to fetch event: {}", e);
}
res.ok().flatten()
}) {
};
let lock = services().globals.stateres_mutex.lock();
let state = match state_res::resolve(
room_version_id,
&fork_states,
auth_chain_sets,
fetch_event,
) {
Ok(new_state) => new_state,
Err(_) => {
return Err(Error::bad_database("State resolution failed, either an event could not be found or deserialization"));

View File

@ -133,8 +133,7 @@ impl Service {
.ok_or_else(|| Error::bad_database("Event in space state not found"))?;
if serde_json::from_str::<SpaceChildEventContent>(pdu.content.get())
.ok()
.and_then(|c| Some(c.via))
.ok().map(|c| c.via)
.map_or(true, |v| v.is_empty())
{
continue;