fix lints revealed by tracing change

<https://github.com/tokio-rs/tracing/pull/3108> changes #[instrument] so
that several lints that were previously hidden on instrumented functions
are now visible.
This commit is contained in:
Olivia Lee 2025-07-20 13:55:06 -07:00 committed by Charles Hall
parent 13203d3b45
commit 2648991092
12 changed files with 37 additions and 40 deletions

View file

@ -182,6 +182,8 @@ impl Service {
}))
}
// Allowed because this function uses `services()`
#[allow(clippy::unused_self)]
#[tracing::instrument(skip(self))]
fn get_auth_chain_inner(
&self,

View file

@ -82,6 +82,7 @@ impl Service {
/// 13. Use state resolution to find new room state
/// 14. Check if the event passes auth based on the "current state" of the
/// room, if not soft fail it
#[allow(clippy::too_many_lines)]
#[tracing::instrument(skip(self, value, is_timeline_event, pub_key_map))]
pub(crate) async fn handle_incoming_pdu<'a>(
&self,
@ -535,6 +536,7 @@ impl Service {
})
}
#[allow(clippy::too_many_lines)]
#[tracing::instrument(skip_all, fields(
incoming_pdu = %incoming_pdu.event_id,
))]
@ -1869,6 +1871,7 @@ impl Service {
/// Search the DB for the signing keys of the given server, if we don't have
/// them fetch them from the server and save to our DB.
#[allow(clippy::too_many_lines)]
#[tracing::instrument(
skip(self, signature_ids),
fields(signature_ids = debug_slice_truncated(&signature_ids, 3))

View file

@ -142,7 +142,7 @@ impl Service {
services().rooms.state_cache.update_membership(
room_id,
&user_id,
membership,
&membership,
&pdu.sender,
None,
false,
@ -319,6 +319,8 @@ impl Service {
/// Gather events to help the invited user identify the room
///
/// Also includes the invite event itself.
// Allowed because this function uses `services()`
#[allow(clippy::unused_self)]
#[tracing::instrument(skip(self, invite_event))]
pub(crate) fn get_helpful_invite_events(
&self,
@ -365,6 +367,8 @@ impl Service {
}
/// Returns the value of a field of an `m.room.create` event's `content`.
// Allowed because this function uses `services()`
#[allow(clippy::unused_self)]
#[tracing::instrument(skip(self))]
pub(crate) fn get_create_content<T: ExtractCreateContent>(
&self,

View file

@ -140,6 +140,8 @@ impl Service {
/// Returns a single PDU from `room_id` with key (`event_type`,
/// `state_key`).
// Allowed because this function uses `services()`
#[allow(clippy::unused_self)]
#[tracing::instrument(skip(self))]
pub(crate) fn state_get_id(
&self,

View file

@ -47,12 +47,14 @@ impl Service {
}
/// Update current membership data.
// Allowed because this function uses `services()`
#[allow(clippy::unused_self)]
#[tracing::instrument(skip(self, last_state))]
pub(crate) fn update_membership(
&self,
room_id: &RoomId,
user_id: &UserId,
membership: MembershipState,
membership: &MembershipState,
sender: &UserId,
last_state: Option<Vec<Raw<AnyStrippedStateEvent>>>,
update_joined_count: bool,
@ -404,6 +406,8 @@ impl Service {
}
/// Returns an iterator over all invited members of a room.
// Unused, but needed for consistency with other methods
#[allow(dead_code)]
#[tracing::instrument(skip(self))]
pub(crate) fn room_members_invited<'a>(
&'a self,
@ -504,6 +508,8 @@ impl Service {
self.db.is_invited(user_id, room_id)
}
// Unused, but needed for consistency with other methods
#[allow(dead_code)]
#[tracing::instrument(skip(self))]
pub(crate) fn is_left(
&self,

View file

@ -277,6 +277,7 @@ impl Service {
/// happens in `append_pdu`.
///
/// Returns pdu id
#[allow(clippy::too_many_lines)]
#[tracing::instrument(skip(self, pdu, pdu_json, leaves))]
pub(crate) async fn append_pdu(
&self,
@ -572,7 +573,7 @@ impl Service {
services().rooms.state_cache.update_membership(
&pdu.room_id,
&target_user_id,
membership,
&membership,
&pdu.sender,
invite_state,
true,
@ -937,6 +938,7 @@ impl Service {
/// Creates a new persisted data unit and adds it to a room. This function
/// takes a roomid_mutex_state, meaning that only this function is able
/// to mutate the room state.
#[allow(clippy::too_many_lines)]
#[tracing::instrument(skip(self))]
pub(crate) async fn build_and_append_pdu(
&self,
@ -1259,7 +1261,7 @@ impl Service {
.rooms
.state
.get_create_content::<ExtractVersion>(&pdu.room_id)?;
pdu.redact(room_version_id, reason)?;
pdu.redact(&room_version_id, reason)?;
self.replace_pdu(
&pdu_id,