enable needless_pass_by_value lint

This commit is contained in:
Charles Hall 2024-05-14 18:41:37 -07:00
parent c4a9bca16f
commit a636405bed
No known key found for this signature in database
GPG key ID: 7B8E0645816E07CF
3 changed files with 10 additions and 9 deletions

View file

@ -55,6 +55,7 @@ missing_assert_message = "warn"
mod_module_files = "warn" mod_module_files = "warn"
multiple_inherent_impl = "warn" multiple_inherent_impl = "warn"
mutex_atomic = "warn" mutex_atomic = "warn"
needless_pass_by_value = "warn"
negative_feature_names = "warn" negative_feature_names = "warn"
pub_without_shorthand = "warn" pub_without_shorthand = "warn"
rc_buffer = "warn" rc_buffer = "warn"

View file

@ -43,8 +43,8 @@ pub(crate) async fn get_relating_events_with_rel_type_and_event_type_route(
sender_user, sender_user,
&body.room_id, &body.room_id,
&body.event_id, &body.event_id,
Some(body.event_type.clone()), Some(&body.event_type),
Some(body.rel_type.clone()), Some(&body.rel_type),
from, from,
to, to,
limit, limit,
@ -95,7 +95,7 @@ pub(crate) async fn get_relating_events_with_rel_type_route(
&body.room_id, &body.room_id,
&body.event_id, &body.event_id,
None, None,
Some(body.rel_type.clone()), Some(&body.rel_type),
from, from,
to, to,
limit, limit,

View file

@ -46,8 +46,8 @@ impl Service {
sender_user: &UserId, sender_user: &UserId,
room_id: &RoomId, room_id: &RoomId,
target: &EventId, target: &EventId,
filter_event_type: Option<TimelineEventType>, filter_event_type: Option<&TimelineEventType>,
filter_rel_type: Option<RelationType>, filter_rel_type: Option<&RelationType>,
from: PduCount, from: PduCount,
to: Option<PduCount>, to: Option<PduCount>,
limit: usize, limit: usize,
@ -63,7 +63,7 @@ impl Service {
.relations_until(sender_user, room_id, target, from)? // TODO: should be relations_after .relations_until(sender_user, room_id, target, from)? // TODO: should be relations_after
.filter(|r| { .filter(|r| {
r.as_ref().map_or(true, |(_, pdu)| { r.as_ref().map_or(true, |(_, pdu)| {
filter_event_type.as_ref().map_or(true, |t| &pdu.kind == t) filter_event_type.as_ref().map_or(true, |t| &&pdu.kind == t)
&& if let Ok(content) = && if let Ok(content) =
serde_json::from_str::<ExtractRelatesToEventId>( serde_json::from_str::<ExtractRelatesToEventId>(
pdu.content.get(), pdu.content.get(),
@ -71,7 +71,7 @@ impl Service {
{ {
filter_rel_type filter_rel_type
.as_ref() .as_ref()
.map_or(true, |r| &content.relates_to.rel_type == r) .map_or(true, |r| &&content.relates_to.rel_type == r)
} else { } else {
false false
} }
@ -110,7 +110,7 @@ impl Service {
.relations_until(sender_user, room_id, target, from)? .relations_until(sender_user, room_id, target, from)?
.filter(|r| { .filter(|r| {
r.as_ref().map_or(true, |(_, pdu)| { r.as_ref().map_or(true, |(_, pdu)| {
filter_event_type.as_ref().map_or(true, |t| &pdu.kind == t) filter_event_type.as_ref().map_or(true, |t| &&pdu.kind == t)
&& if let Ok(content) = && if let Ok(content) =
serde_json::from_str::<ExtractRelatesToEventId>( serde_json::from_str::<ExtractRelatesToEventId>(
pdu.content.get(), pdu.content.get(),
@ -118,7 +118,7 @@ impl Service {
{ {
filter_rel_type filter_rel_type
.as_ref() .as_ref()
.map_or(true, |r| &content.relates_to.rel_type == r) .map_or(true, |r| &&content.relates_to.rel_type == r)
} else { } else {
false false
} }