mirror of
https://gitlab.com/famedly/conduit.git
synced 2024-12-28 05:54:31 +01:00
replace unwraps with expects
This commit is contained in:
parent
976a73a0e5
commit
ace9637bc2
3 changed files with 16 additions and 4 deletions
|
@ -64,7 +64,12 @@ pub async fn join_room_by_id_route(
|
||||||
.map(|user| user.server_name().to_owned()),
|
.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(
|
join_room_by_id_helper(
|
||||||
body.sender_user.as_deref(),
|
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()),
|
.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)
|
(servers, room_id)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1620,7 +1620,7 @@ pub async fn sync_events_v4_route(
|
||||||
} else {
|
} else {
|
||||||
match services().rooms.state_accessor.get_avatar(room_id)? {
|
match services().rooms.state_accessor.get_avatar(room_id)? {
|
||||||
ruma::JsOption::Some(avatar) => {
|
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::Null => ruma::JsOption::Null,
|
||||||
ruma::JsOption::Undefined => ruma::JsOption::Undefined,
|
ruma::JsOption::Undefined => ruma::JsOption::Undefined,
|
||||||
|
|
|
@ -185,7 +185,9 @@ impl Service {
|
||||||
stack.push(children_ids);
|
stack.push(children_ids);
|
||||||
}
|
}
|
||||||
} else {
|
} 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() {
|
if server == services().globals.server_name() {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue