1
0
Fork 0
mirror of https://gitlab.com/famedly/conduit.git synced 2024-11-16 16:20:50 +01:00

replace unwraps with expects

This commit is contained in:
Matthias Ahouansou 2024-02-23 19:39:30 +00:00
parent 976a73a0e5
commit ace9637bc2
3 changed files with 16 additions and 4 deletions

View file

@ -64,7 +64,12 @@ pub async fn join_room_by_id_route(
.map(|user| user.server_name().to_owned()),
);
servers.push(body.room_id.server_name().unwrap().into());
servers.push(
body.room_id
.server_name()
.expect("Room IDs should always have a server name")
.into(),
);
join_room_by_id_helper(
body.sender_user.as_deref(),
@ -105,7 +110,12 @@ pub async fn join_room_by_id_or_alias_route(
.map(|user| user.server_name().to_owned()),
);
servers.push(room_id.server_name().unwrap().into());
servers.push(
room_id
.server_name()
.expect("Room IDs should always have a server name")
.into(),
);
(servers, room_id)
}

View file

@ -1620,7 +1620,7 @@ pub async fn sync_events_v4_route(
} else {
match services().rooms.state_accessor.get_avatar(room_id)? {
ruma::JsOption::Some(avatar) => {
js_option::JsOption::Some(avatar.url.unwrap())
js_option::JsOption::from_option(avatar.url)
}
ruma::JsOption::Null => ruma::JsOption::Null,
ruma::JsOption::Undefined => ruma::JsOption::Undefined,

View file

@ -185,7 +185,9 @@ impl Service {
stack.push(children_ids);
}
} else {
let server = current_room.server_name().unwrap();
let server = current_room
.server_name()
.expect("Room IDs should always have a server name");
if server == services().globals.server_name() {
continue;
}