Fix equatable if let
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
b525031a25
commit
89d7d48324
4 changed files with 13 additions and 11 deletions
|
@ -715,7 +715,6 @@ correctness = "warn"
|
||||||
nursery = "warn"
|
nursery = "warn"
|
||||||
|
|
||||||
## some sadness
|
## some sadness
|
||||||
equatable_if_let = { level = "allow", priority = 1 } # TODO
|
|
||||||
future_not_send = { level = "allow", priority = 1 } # TODO
|
future_not_send = { level = "allow", priority = 1 } # TODO
|
||||||
missing_const_for_fn = { level = "allow", priority = 1 } # TODO
|
missing_const_for_fn = { level = "allow", priority = 1 } # TODO
|
||||||
needless_collect = { level = "allow", priority = 1 } # TODO
|
needless_collect = { level = "allow", priority = 1 } # TODO
|
||||||
|
|
|
@ -631,7 +631,7 @@ pub async fn join_room_by_id_helper(
|
||||||
) -> Result<join_room_by_id::v3::Response> {
|
) -> Result<join_room_by_id::v3::Response> {
|
||||||
let sender_user = sender_user.expect("user is authenticated");
|
let sender_user = sender_user.expect("user is authenticated");
|
||||||
|
|
||||||
if let Ok(true) = services().rooms.state_cache.is_joined(sender_user, room_id) {
|
if matches!(services().rooms.state_cache.is_joined(sender_user, room_id), Ok(true)) {
|
||||||
info!("{sender_user} is already joined in {room_id}");
|
info!("{sender_user} is already joined in {room_id}");
|
||||||
return Ok(join_room_by_id::v3::Response {
|
return Ok(join_room_by_id::v3::Response {
|
||||||
room_id: room_id.into(),
|
room_id: room_id.into(),
|
||||||
|
|
|
@ -104,14 +104,14 @@ fn is_report_valid(
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(true) = score.map(|s| s > int!(0) || s < int!(-100)) {
|
if score.map(|s| s > int!(0) || s < int!(-100)) == Some(true) {
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::InvalidParam,
|
ErrorKind::InvalidParam,
|
||||||
"Invalid score, must be within 0 to -100",
|
"Invalid score, must be within 0 to -100",
|
||||||
));
|
));
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(true) = reason.clone().map(|s| s.len() >= 750) {
|
if reason.clone().map(|s| s.len() >= 750) == Some(true) {
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::InvalidParam,
|
ErrorKind::InvalidParam,
|
||||||
"Reason too long, should be 750 characters or fewer",
|
"Reason too long, should be 750 characters or fewer",
|
||||||
|
|
|
@ -108,7 +108,7 @@ impl Arena {
|
||||||
// whole space tree.
|
// whole space tree.
|
||||||
//
|
//
|
||||||
// You should only ever encounter a traversed node when going up through parents
|
// You should only ever encounter a traversed node when going up through parents
|
||||||
while let Some(true) = self.traversed(current) {
|
while self.traversed(current) == Some(true) {
|
||||||
if let Some(next) = self.next_sibling(current) {
|
if let Some(next) = self.next_sibling(current) {
|
||||||
current = next;
|
current = next;
|
||||||
} else if let Some(parent) = self.parent(current) {
|
} else if let Some(parent) = self.parent(current) {
|
||||||
|
@ -821,12 +821,15 @@ fn is_accessable_child_recurse(
|
||||||
SpaceRoomJoinRule::Restricted => {
|
SpaceRoomJoinRule::Restricted => {
|
||||||
for room in allowed_room_ids {
|
for room in allowed_room_ids {
|
||||||
if let Ok((join_rule, allowed_room_ids)) = get_join_rule(room) {
|
if let Ok((join_rule, allowed_room_ids)) = get_join_rule(room) {
|
||||||
if let Ok(true) = is_accessable_child_recurse(
|
if matches!(
|
||||||
room,
|
is_accessable_child_recurse(
|
||||||
&join_rule,
|
room,
|
||||||
identifier,
|
&join_rule,
|
||||||
&allowed_room_ids,
|
identifier,
|
||||||
recurse_num + 1,
|
&allowed_room_ids,
|
||||||
|
recurse_num + 1,
|
||||||
|
),
|
||||||
|
Ok(true)
|
||||||
) {
|
) {
|
||||||
return Ok(true);
|
return Ok(true);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue