style: Reformat and whatnot

This commit is contained in:
nexy7574 2025-08-30 17:00:31 +01:00
commit cfd68efb99
No known key found for this signature in database
6 changed files with 8 additions and 15 deletions

View file

@ -200,7 +200,7 @@ async fn is_event_report_valid(
valid" valid"
); );
if room_id != &pdu.room_id_or_hash() { if room_id != pdu.room_id_or_hash() {
return Err!(Request(NotFound("Event ID does not belong to the reported room",))); return Err!(Request(NotFound("Event ID does not belong to the reported room",)));
} }

View file

@ -91,7 +91,7 @@ pub(crate) async fn create_room_route(
// check if room ID doesn't already exist instead of erroring on auth check // check if room ID doesn't already exist instead of erroring on auth check
if let Some(ref room_id) = room_id { if let Some(ref room_id) = room_id {
if services.rooms.short.get_shortroomid(&room_id).await.is_ok() { if services.rooms.short.get_shortroomid(room_id).await.is_ok() {
return Err!(Request(RoomInUse("Room with that custom room ID already exists",))); return Err!(Request(RoomInUse("Room with that custom room ID already exists",)));
} }
} }

View file

@ -17,12 +17,8 @@ pub const STABLE_ROOM_VERSIONS: &[RoomVersionId] = &[
]; ];
/// Experimental, partially supported room versions /// Experimental, partially supported room versions
pub const UNSTABLE_ROOM_VERSIONS: &[RoomVersionId] = &[ pub const UNSTABLE_ROOM_VERSIONS: &[RoomVersionId] =
RoomVersionId::V3, &[RoomVersionId::V3, RoomVersionId::V4, RoomVersionId::V5, RoomVersionId::V12];
RoomVersionId::V4,
RoomVersionId::V5,
RoomVersionId::V12,
];
type RoomVersion = (RoomVersionId, RoomVersionStability); type RoomVersion = (RoomVersionId, RoomVersionStability);

View file

@ -289,11 +289,11 @@ where
let mut path: Vec<OwnedEventId> = Vec::new(); let mut path: Vec<OwnedEventId> = Vec::new();
let mut seen: HashSet<OwnedEventId> = HashSet::new(); let mut seen: HashSet<OwnedEventId> = HashSet::new();
let next_event = |stack: &mut Vec<Vec<_>>, path: &mut Vec<_>| { let next_event = |stack: &mut Vec<Vec<_>>, path: &mut Vec<_>| {
while stack.last().is_some_and(|s| s.is_empty()) { while stack.last().is_some_and(std::vec::Vec::is_empty) {
stack.pop(); stack.pop();
path.pop(); path.pop();
} }
stack.last_mut().and_then(|s| s.pop()) stack.last_mut().and_then(std::vec::Vec::pop)
}; };
while let Some(event_id) = next_event(&mut stack, &mut path) { while let Some(event_id) = next_event(&mut stack, &mut path) {
path.push(event_id.clone()); path.push(event_id.clone());

View file

@ -58,10 +58,8 @@ pub async fn handle_incoming_pdu<'a>(
value: BTreeMap<String, CanonicalJsonValue>, value: BTreeMap<String, CanonicalJsonValue>,
is_timeline_event: bool, is_timeline_event: bool,
) -> Result<Option<RawPduId>> { ) -> Result<Option<RawPduId>> {
if room_id.is_empty() { // TODO(hydra): Room IDs should be calculated before this function is called
// TODO(hydra): Room IDs should be calculated before this function is called assert!(!room_id.is_empty(), "room ID cannot be empty");
panic!("room ID cannot be empty");
}
// 1. Skip the PDU if we already have it as a timeline event // 1. Skip the PDU if we already have it as a timeline event
if let Ok(pdu_id) = self.services.timeline.get_pdu_id(event_id).await { if let Ok(pdu_id) = self.services.timeline.get_pdu_id(event_id).await {
return Ok(Some(pdu_id)); return Ok(Some(pdu_id));

View file

@ -16,7 +16,6 @@ use conduwuit_database::{Deserialized, Ignore, Interfix, Map};
use futures::{ use futures::{
FutureExt, Stream, StreamExt, TryFutureExt, TryStreamExt, future::join_all, pin_mut, FutureExt, Stream, StreamExt, TryFutureExt, TryStreamExt, future::join_all, pin_mut,
}; };
use log::trace;
use ruma::{ use ruma::{
EventId, OwnedEventId, OwnedRoomId, RoomId, RoomVersionId, UserId, EventId, OwnedEventId, OwnedRoomId, RoomId, RoomVersionId, UserId,
events::{ events::{