fix edition 2024 lints
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
cbf207bd1f
commit
a67ab75417
36 changed files with 60 additions and 72 deletions
|
@ -499,7 +499,7 @@ pub(crate) async fn register_route(
|
|||
| _ => {
|
||||
info!("Automatically joined room {room} for user {user_id}");
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ pub(crate) async fn set_room_visibility_route(
|
|||
|
||||
if !services.rooms.metadata.exists(&body.room_id).await {
|
||||
// Return 404 if the room doesn't exist
|
||||
return Err(Error::BadRequest(ErrorKind::NotFound, "Room not found"));
|
||||
return Err!(Request(NotFound("Room not found")));
|
||||
}
|
||||
|
||||
if services
|
||||
|
@ -145,10 +145,7 @@ pub(crate) async fn set_room_visibility_route(
|
|||
}
|
||||
|
||||
if !user_can_publish_room(&services, sender_user, &body.room_id).await? {
|
||||
return Err(Error::BadRequest(
|
||||
ErrorKind::forbidden(),
|
||||
"User is not allowed to publish this room",
|
||||
));
|
||||
return Err!(Request(Forbidden("User is not allowed to publish this room")));
|
||||
}
|
||||
|
||||
match &body.visibility {
|
||||
|
@ -386,12 +383,7 @@ async fn user_can_publish_room(
|
|||
.await
|
||||
{
|
||||
| Ok(event) => Ok(event.sender == user_id),
|
||||
| _ => {
|
||||
return Err(Error::BadRequest(
|
||||
ErrorKind::forbidden(),
|
||||
"User is not allowed to publish this room",
|
||||
));
|
||||
},
|
||||
| _ => Err!(Request(Forbidden("User is not allowed to publish this room"))),
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
@ -993,7 +993,7 @@ async fn join_room_by_id_helper_remote(
|
|||
| _ => {
|
||||
join_event_stub.remove("event_id");
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
// In order to create a compatible ref hash (EventID) the `hashes` field needs
|
||||
// to be present
|
||||
|
@ -1420,7 +1420,7 @@ async fn join_room_by_id_helper_local(
|
|||
| _ => {
|
||||
join_event_stub.remove("event_id");
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
// In order to create a compatible ref hash (EventID) the `hashes` field needs
|
||||
// to be present
|
||||
|
@ -1947,7 +1947,7 @@ async fn remote_leave_room(
|
|||
| _ => {
|
||||
leave_event_stub.remove("event_id");
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
// In order to create a compatible ref hash (EventID) the `hashes` field needs
|
||||
// to be present
|
||||
|
|
|
@ -43,7 +43,7 @@ pub(crate) async fn report_room_route(
|
|||
ErrorKind::InvalidParam,
|
||||
"Reason too long, should be 750 characters or fewer",
|
||||
));
|
||||
};
|
||||
}
|
||||
|
||||
delay_response().await;
|
||||
|
||||
|
@ -164,14 +164,14 @@ async fn is_event_report_valid(
|
|||
ErrorKind::InvalidParam,
|
||||
"Invalid score, must be within 0 to -100",
|
||||
));
|
||||
};
|
||||
}
|
||||
|
||||
if reason.as_ref().is_some_and(|s| s.len() > 750) {
|
||||
return Err(Error::BadRequest(
|
||||
ErrorKind::InvalidParam,
|
||||
"Reason too long, should be 750 characters or fewer",
|
||||
));
|
||||
};
|
||||
}
|
||||
|
||||
if !services
|
||||
.rooms
|
||||
|
|
|
@ -110,7 +110,7 @@ pub(super) async fn auth(
|
|||
}
|
||||
},
|
||||
| _ => {},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
match (metadata.authentication, token) {
|
||||
|
|
|
@ -135,7 +135,7 @@ async fn create_join_event(
|
|||
|
||||
if state_key != sender {
|
||||
return Err!(Request(BadJson("State key does not match sender user.")));
|
||||
};
|
||||
}
|
||||
|
||||
if let Some(authorising_user) = content.join_authorized_via_users_server {
|
||||
use ruma::RoomVersionId::*;
|
||||
|
|
|
@ -137,7 +137,7 @@ pub(crate) async fn create_knock_event_v1_route(
|
|||
|
||||
if state_key != sender {
|
||||
return Err!(Request(InvalidParam("state_key does not match sender user of event.")));
|
||||
};
|
||||
}
|
||||
|
||||
let origin: OwnedServerName = serde_json::from_value(
|
||||
value
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue