mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-16 07:11:24 +01:00
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:
parent
13203d3b45
commit
2648991092
12 changed files with 37 additions and 40 deletions
|
|
@ -320,7 +320,7 @@ async fn get_remote_content_via_legacy_api(
|
|||
}
|
||||
|
||||
#[tracing::instrument]
|
||||
pub(crate) async fn get_remote_content(
|
||||
async fn get_remote_content(
|
||||
mxc: &MxcData<'_>,
|
||||
) -> Result<RemoteResponse, Error> {
|
||||
let fed_result = get_remote_content_via_federation_api(mxc).await;
|
||||
|
|
@ -785,7 +785,7 @@ async fn get_remote_thumbnail_via_legacy_api(
|
|||
}
|
||||
|
||||
#[tracing::instrument]
|
||||
pub(crate) async fn get_remote_thumbnail(
|
||||
async fn get_remote_thumbnail(
|
||||
server_name: &ruma::ServerName,
|
||||
request: authenticated_media_fed::get_content_thumbnail::v1::Request,
|
||||
) -> Result<RemoteResponse, Error> {
|
||||
|
|
|
|||
|
|
@ -1521,7 +1521,7 @@ pub(crate) async fn leave_room(
|
|||
services().rooms.state_cache.update_membership(
|
||||
room_id,
|
||||
user_id,
|
||||
MembershipState::Leave,
|
||||
&MembershipState::Leave,
|
||||
user_id,
|
||||
None,
|
||||
true,
|
||||
|
|
@ -1575,7 +1575,7 @@ pub(crate) async fn leave_room(
|
|||
services().rooms.state_cache.update_membership(
|
||||
room_id,
|
||||
user_id,
|
||||
MembershipState::Leave,
|
||||
&MembershipState::Leave,
|
||||
user_id,
|
||||
last_state,
|
||||
true,
|
||||
|
|
|
|||
|
|
@ -915,6 +915,7 @@ async fn load_joined_room(
|
|||
})
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_lines)]
|
||||
#[tracing::instrument(skip_all)]
|
||||
async fn collect_left_rooms(
|
||||
ctx: &SyncContext<'_>,
|
||||
|
|
|
|||
|
|
@ -147,6 +147,7 @@ pub(crate) enum AllowLoopbackRequests {
|
|||
No,
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_lines)]
|
||||
#[tracing::instrument(skip(request, log_error, allow_loopback), fields(url))]
|
||||
pub(crate) async fn send_request<T>(
|
||||
destination: &ServerName,
|
||||
|
|
@ -1883,7 +1884,7 @@ pub(crate) async fn create_invite_route(
|
|||
services().rooms.state_cache.update_membership(
|
||||
&body.room_id,
|
||||
&invited_user,
|
||||
MembershipState::Invite,
|
||||
&MembershipState::Invite,
|
||||
&sender,
|
||||
Some(invite_state),
|
||||
true,
|
||||
|
|
|
|||
|
|
@ -4,10 +4,9 @@ use ruma::{
|
|||
canonical_json::redact_content_in_place,
|
||||
events::{
|
||||
room::member::RoomMemberEventContent,
|
||||
space::child::HierarchySpaceChildEvent, AnyEphemeralRoomEvent,
|
||||
AnyMessageLikeEvent, AnyStateEvent, AnyStrippedStateEvent,
|
||||
AnySyncStateEvent, AnySyncTimelineEvent, AnyTimelineEvent, StateEvent,
|
||||
TimelineEventType,
|
||||
space::child::HierarchySpaceChildEvent, AnyMessageLikeEvent,
|
||||
AnyStateEvent, AnyStrippedStateEvent, AnySyncStateEvent,
|
||||
AnySyncTimelineEvent, AnyTimelineEvent, StateEvent, TimelineEventType,
|
||||
},
|
||||
serde::Raw,
|
||||
state_res, CanonicalJsonObject, CanonicalJsonValue, EventId,
|
||||
|
|
@ -60,7 +59,7 @@ impl PduEvent {
|
|||
#[tracing::instrument(skip(self))]
|
||||
pub(crate) fn redact(
|
||||
&mut self,
|
||||
room_version_id: RoomVersionId,
|
||||
room_version_id: &RoomVersionId,
|
||||
reason: &PduEvent,
|
||||
) -> crate::Result<()> {
|
||||
self.unsigned = None;
|
||||
|
|
@ -71,7 +70,7 @@ impl PduEvent {
|
|||
})?;
|
||||
redact_content_in_place(
|
||||
&mut content,
|
||||
&room_version_id,
|
||||
room_version_id,
|
||||
self.kind.to_string(),
|
||||
)
|
||||
.map_err(|e| {
|
||||
|
|
@ -222,31 +221,6 @@ impl PduEvent {
|
|||
serde_json::from_value(json).expect("Raw::from_value always works")
|
||||
}
|
||||
|
||||
/// This only works for events that are also AnyRoomEvents.
|
||||
#[tracing::instrument(skip(self))]
|
||||
pub(crate) fn to_any_event(&self) -> Raw<AnyEphemeralRoomEvent> {
|
||||
let mut json = json!({
|
||||
"content": self.content,
|
||||
"type": self.kind,
|
||||
"event_id": self.event_id,
|
||||
"sender": self.sender,
|
||||
"origin_server_ts": self.origin_server_ts,
|
||||
"room_id": self.room_id,
|
||||
});
|
||||
|
||||
if let Some(unsigned) = &self.unsigned {
|
||||
json["unsigned"] = json!(unsigned);
|
||||
}
|
||||
if let Some(state_key) = &self.state_key {
|
||||
json["state_key"] = json!(state_key);
|
||||
}
|
||||
if let Some(redacts) = &self.redacts {
|
||||
json["redacts"] = json!(redacts);
|
||||
}
|
||||
|
||||
serde_json::from_value(json).expect("Raw::from_value always works")
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(self))]
|
||||
pub(crate) fn to_room_event(&self) -> Raw<AnyTimelineEvent> {
|
||||
let (redacts, content) = self.copy_redacts();
|
||||
|
|
|
|||
|
|
@ -210,6 +210,8 @@ impl Service {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
// Allowed because this function uses `services()`
|
||||
#[allow(clippy::unused_self)]
|
||||
#[tracing::instrument(skip(self, user, ruleset, pdu))]
|
||||
pub(crate) fn get_actions<'a>(
|
||||
&self,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue