perf: Remove unnecessary clones for PDU size check

This commit is contained in:
timedout committed 2026-11-17 10:17:15 +00:00
1 parent 902e54b525
commit 467e335c90
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -534,7 +534,7 @@ impl Service {
return state;
},
};
if !pdu_fits(&value.clone()) {
if !pdu_fits(&value) {
warn!(
"dropping incoming PDU {event_id} in room {room_id} from room join \
because it exceeds 65535 bytes or is otherwise too large."
+1 -1
View File
@@ -330,7 +330,7 @@ impl super::Service {
pdu_json
.insert("event_id".into(), CanonicalJsonValue::String(pdu.event_id.clone().into()));
// Verify that the *full* PDU isn't over 64KiB.
if !pdu_fits(&pdu_json.clone()) {
if !pdu_fits(&pdu_json) {
// feckin huge PDU mate
return Err!(Request(TooLarge("Message/PDU is too long (exceeds 65536 bytes)")));
}