Use self instead of going through services()

This commit is contained in:
Lambda 2024-09-01 11:35:02 +00:00
parent f52cf53931
commit 341f4213d0
8 changed files with 26 additions and 60 deletions

View file

@ -45,12 +45,7 @@ impl Service {
}
}
#[allow(
clippy::too_many_arguments,
clippy::too_many_lines,
// Allowed because this function uses `services()`
clippy::unused_self,
)]
#[allow(clippy::too_many_arguments, clippy::too_many_lines)]
#[tracing::instrument(skip(self))]
pub(crate) fn paginate_relations_with_filter(
&self,
@ -69,9 +64,7 @@ impl Service {
match ruma::api::Direction::Backward {
ruma::api::Direction::Forward => {
// TODO: should be relations_after
let events_after: Vec<_> = services()
.rooms
.pdu_metadata
let events_after: Vec<_> = self
.relations_until(sender_user, room_id, target, from)?
.filter(|r| {
r.as_ref().map_or(true, |(_, pdu)| {
@ -126,9 +119,7 @@ impl Service {
})
}
ruma::api::Direction::Backward => {
let events_before: Vec<_> = services()
.rooms
.pdu_metadata
let events_before: Vec<_> = self
.relations_until(sender_user, room_id, target, from)?
.filter(|r| {
r.as_ref().map_or(true, |(_, pdu)| {