diff --git a/dtls/src/extension/extension_server_name.rs b/dtls/src/extension/extension_server_name.rs index dbe018e9f..92fd259b2 100644 --- a/dtls/src/extension/extension_server_name.rs +++ b/dtls/src/extension/extension_server_name.rs @@ -21,7 +21,7 @@ impl ExtensionServerName { pub fn size(&self) -> usize { //TODO: check how to do cryptobyte? - 2 + 2 + 1 + 2 + self.server_name.as_bytes().len() + 2 + 2 + 1 + 2 + self.server_name.len() } pub fn marshal(&self, writer: &mut W) -> Result<()> { diff --git a/ice/src/agent/agent_internal.rs b/ice/src/agent/agent_internal.rs index dc943b5b4..6532f7f79 100644 --- a/ice/src/agent/agent_internal.rs +++ b/ice/src/agent/agent_internal.rs @@ -984,7 +984,7 @@ impl AgentInternal { ) -> bool { self.find_remote_candidate(local.network_type(), remote) .await - .map_or(false, |remote_candidate| { + .is_some_and(|remote_candidate| { remote_candidate.seen(false); true }) diff --git a/mdns/src/message/resource/txt.rs b/mdns/src/message/resource/txt.rs index 64888ff84..5b43c02bf 100644 --- a/mdns/src/message/resource/txt.rs +++ b/mdns/src/message/resource/txt.rs @@ -43,7 +43,7 @@ impl ResourceBody for TxtResource { let (t, new_off) = unpack_str(msg, off)?; off = new_off; // Check if we got too many bytes. - if length < n + t.as_bytes().len() + 1 { + if length < n + t.len() + 1 { return Err(Error::ErrCalcLen); } n += t.len() + 1; diff --git a/rtcp/src/compound_packet/mod.rs b/rtcp/src/compound_packet/mod.rs index 6a744f177..74b699574 100644 --- a/rtcp/src/compound_packet/mod.rs +++ b/rtcp/src/compound_packet/mod.rs @@ -66,10 +66,7 @@ impl Packet for CompoundPacket { } fn equal(&self, other: &(dyn Packet + Send + Sync)) -> bool { - other - .as_any() - .downcast_ref::() - .map_or(false, |a| self == a) + other.as_any().downcast_ref::() == Some(self) } fn cloned(&self) -> Box { diff --git a/rtcp/src/extended_report/dlrr.rs b/rtcp/src/extended_report/dlrr.rs index c5d9693d3..0d24f5d12 100644 --- a/rtcp/src/extended_report/dlrr.rs +++ b/rtcp/src/extended_report/dlrr.rs @@ -77,10 +77,7 @@ impl Packet for DLRRReportBlock { self } fn equal(&self, other: &(dyn Packet + Send + Sync)) -> bool { - other - .as_any() - .downcast_ref::() - .map_or(false, |a| self == a) + other.as_any().downcast_ref::() == Some(self) } fn cloned(&self) -> Box { Box::new(self.clone()) diff --git a/rtcp/src/extended_report/mod.rs b/rtcp/src/extended_report/mod.rs index e8a2f3732..ed9e49f1b 100644 --- a/rtcp/src/extended_report/mod.rs +++ b/rtcp/src/extended_report/mod.rs @@ -199,10 +199,7 @@ impl Packet for ExtendedReport { } fn equal(&self, other: &(dyn Packet + Send + Sync)) -> bool { - other - .as_any() - .downcast_ref::() - .map_or(false, |a| self == a) + other.as_any().downcast_ref::() == Some(self) } fn cloned(&self) -> Box { diff --git a/rtcp/src/extended_report/prt.rs b/rtcp/src/extended_report/prt.rs index c9da820cb..9c3383b9b 100644 --- a/rtcp/src/extended_report/prt.rs +++ b/rtcp/src/extended_report/prt.rs @@ -71,7 +71,7 @@ impl Packet for PacketReceiptTimesReportBlock { other .as_any() .downcast_ref::() - .map_or(false, |a| self == a) + == Some(self) } fn cloned(&self) -> Box { Box::new(self.clone()) diff --git a/rtcp/src/extended_report/rle.rs b/rtcp/src/extended_report/rle.rs index fe6770b76..6677bb7c0 100644 --- a/rtcp/src/extended_report/rle.rs +++ b/rtcp/src/extended_report/rle.rs @@ -163,10 +163,7 @@ impl Packet for RLEReportBlock { self } fn equal(&self, other: &(dyn Packet + Send + Sync)) -> bool { - other - .as_any() - .downcast_ref::() - .map_or(false, |a| self == a) + other.as_any().downcast_ref::() == Some(self) } fn cloned(&self) -> Box { Box::new(self.clone()) diff --git a/rtcp/src/extended_report/rrt.rs b/rtcp/src/extended_report/rrt.rs index fa0b34d65..8c069f595 100644 --- a/rtcp/src/extended_report/rrt.rs +++ b/rtcp/src/extended_report/rrt.rs @@ -56,7 +56,7 @@ impl Packet for ReceiverReferenceTimeReportBlock { other .as_any() .downcast_ref::() - .map_or(false, |a| self == a) + == Some(self) } fn cloned(&self) -> Box { Box::new(self.clone()) diff --git a/rtcp/src/extended_report/ssr.rs b/rtcp/src/extended_report/ssr.rs index c4c29e0b5..c1ee62bf5 100644 --- a/rtcp/src/extended_report/ssr.rs +++ b/rtcp/src/extended_report/ssr.rs @@ -132,7 +132,7 @@ impl Packet for StatisticsSummaryReportBlock { other .as_any() .downcast_ref::() - .map_or(false, |a| self == a) + == Some(self) } fn cloned(&self) -> Box { Box::new(self.clone()) diff --git a/rtcp/src/extended_report/unknown.rs b/rtcp/src/extended_report/unknown.rs index 707d77231..7243b1e4b 100644 --- a/rtcp/src/extended_report/unknown.rs +++ b/rtcp/src/extended_report/unknown.rs @@ -41,10 +41,7 @@ impl Packet for UnknownReportBlock { self } fn equal(&self, other: &(dyn Packet + Send + Sync)) -> bool { - other - .as_any() - .downcast_ref::() - .map_or(false, |a| self == a) + other.as_any().downcast_ref::() == Some(self) } fn cloned(&self) -> Box { Box::new(self.clone()) diff --git a/rtcp/src/extended_report/vm.rs b/rtcp/src/extended_report/vm.rs index 91cb79099..834fea223 100644 --- a/rtcp/src/extended_report/vm.rs +++ b/rtcp/src/extended_report/vm.rs @@ -86,10 +86,7 @@ impl Packet for VoIPMetricsReportBlock { self } fn equal(&self, other: &(dyn Packet + Send + Sync)) -> bool { - other - .as_any() - .downcast_ref::() - .map_or(false, |a| self == a) + other.as_any().downcast_ref::() == Some(self) } fn cloned(&self) -> Box { Box::new(self.clone()) diff --git a/rtcp/src/goodbye/mod.rs b/rtcp/src/goodbye/mod.rs index 9fa44fd77..a26dc949b 100644 --- a/rtcp/src/goodbye/mod.rs +++ b/rtcp/src/goodbye/mod.rs @@ -63,10 +63,7 @@ impl Packet for Goodbye { } fn equal(&self, other: &(dyn Packet + Send + Sync)) -> bool { - other - .as_any() - .downcast_ref::() - .map_or(false, |a| self == a) + other.as_any().downcast_ref::() == Some(self) } fn cloned(&self) -> Box { diff --git a/rtcp/src/payload_feedbacks/full_intra_request/mod.rs b/rtcp/src/payload_feedbacks/full_intra_request/mod.rs index fa8440889..c2a9532c3 100644 --- a/rtcp/src/payload_feedbacks/full_intra_request/mod.rs +++ b/rtcp/src/payload_feedbacks/full_intra_request/mod.rs @@ -71,10 +71,7 @@ impl Packet for FullIntraRequest { } fn equal(&self, other: &(dyn Packet + Send + Sync)) -> bool { - other - .as_any() - .downcast_ref::() - .map_or(false, |a| self == a) + other.as_any().downcast_ref::() == Some(self) } fn cloned(&self) -> Box { diff --git a/rtcp/src/payload_feedbacks/picture_loss_indication/mod.rs b/rtcp/src/payload_feedbacks/picture_loss_indication/mod.rs index 1092e0afc..1385afd7b 100644 --- a/rtcp/src/payload_feedbacks/picture_loss_indication/mod.rs +++ b/rtcp/src/payload_feedbacks/picture_loss_indication/mod.rs @@ -60,10 +60,7 @@ impl Packet for PictureLossIndication { } fn equal(&self, other: &(dyn Packet + Send + Sync)) -> bool { - other - .as_any() - .downcast_ref::() - .map_or(false, |a| self == a) + other.as_any().downcast_ref::() == Some(self) } fn cloned(&self) -> Box { diff --git a/rtcp/src/payload_feedbacks/receiver_estimated_maximum_bitrate/mod.rs b/rtcp/src/payload_feedbacks/receiver_estimated_maximum_bitrate/mod.rs index df48a6886..592c70b34 100644 --- a/rtcp/src/payload_feedbacks/receiver_estimated_maximum_bitrate/mod.rs +++ b/rtcp/src/payload_feedbacks/receiver_estimated_maximum_bitrate/mod.rs @@ -90,7 +90,7 @@ impl Packet for ReceiverEstimatedMaximumBitrate { other .as_any() .downcast_ref::() - .map_or(false, |a| self == a) + == Some(self) } fn cloned(&self) -> Box { diff --git a/rtcp/src/payload_feedbacks/slice_loss_indication/mod.rs b/rtcp/src/payload_feedbacks/slice_loss_indication/mod.rs index c424f5c60..9fba151fa 100644 --- a/rtcp/src/payload_feedbacks/slice_loss_indication/mod.rs +++ b/rtcp/src/payload_feedbacks/slice_loss_indication/mod.rs @@ -75,10 +75,7 @@ impl Packet for SliceLossIndication { } fn equal(&self, other: &(dyn Packet + Send + Sync)) -> bool { - other - .as_any() - .downcast_ref::() - .map_or(false, |a| self == a) + other.as_any().downcast_ref::() == Some(self) } fn cloned(&self) -> Box { diff --git a/rtcp/src/raw_packet.rs b/rtcp/src/raw_packet.rs index dc5fc78d5..97a69cac1 100644 --- a/rtcp/src/raw_packet.rs +++ b/rtcp/src/raw_packet.rs @@ -40,10 +40,7 @@ impl Packet for RawPacket { } fn equal(&self, other: &(dyn Packet + Send + Sync)) -> bool { - other - .as_any() - .downcast_ref::() - .map_or(false, |a| self == a) + other.as_any().downcast_ref::() == Some(self) } fn cloned(&self) -> Box { diff --git a/rtcp/src/receiver_report/mod.rs b/rtcp/src/receiver_report/mod.rs index 369c5d2c1..2ce8e49eb 100644 --- a/rtcp/src/receiver_report/mod.rs +++ b/rtcp/src/receiver_report/mod.rs @@ -80,10 +80,7 @@ impl Packet for ReceiverReport { } fn equal(&self, other: &(dyn Packet + Send + Sync)) -> bool { - other - .as_any() - .downcast_ref::() - .map_or(false, |a| self == a) + other.as_any().downcast_ref::() == Some(self) } fn cloned(&self) -> Box { diff --git a/rtcp/src/reception_report.rs b/rtcp/src/reception_report.rs index b9c49f2ad..fb8bffb99 100644 --- a/rtcp/src/reception_report.rs +++ b/rtcp/src/reception_report.rs @@ -73,10 +73,7 @@ impl Packet for ReceptionReport { } fn equal(&self, other: &(dyn Packet + Send + Sync)) -> bool { - other - .as_any() - .downcast_ref::() - .map_or(false, |a| self == a) + other.as_any().downcast_ref::() == Some(self) } fn cloned(&self) -> Box { diff --git a/rtcp/src/sender_report/mod.rs b/rtcp/src/sender_report/mod.rs index 1e66d9b83..0792ca3a3 100644 --- a/rtcp/src/sender_report/mod.rs +++ b/rtcp/src/sender_report/mod.rs @@ -117,10 +117,7 @@ impl Packet for SenderReport { } fn equal(&self, other: &(dyn Packet + Send + Sync)) -> bool { - other - .as_any() - .downcast_ref::() - .map_or(false, |a| self == a) + other.as_any().downcast_ref::() == Some(self) } fn cloned(&self) -> Box { diff --git a/rtcp/src/source_description/mod.rs b/rtcp/src/source_description/mod.rs index 5cf66545b..ce3f19ba6 100644 --- a/rtcp/src/source_description/mod.rs +++ b/rtcp/src/source_description/mod.rs @@ -321,10 +321,7 @@ impl Packet for SourceDescription { } fn equal(&self, other: &(dyn Packet + Send + Sync)) -> bool { - other - .as_any() - .downcast_ref::() - .map_or(false, |a| self == a) + other.as_any().downcast_ref::() == Some(self) } fn cloned(&self) -> Box { diff --git a/rtcp/src/transport_feedbacks/rapid_resynchronization_request/mod.rs b/rtcp/src/transport_feedbacks/rapid_resynchronization_request/mod.rs index 7ea106755..6709f9f4c 100644 --- a/rtcp/src/transport_feedbacks/rapid_resynchronization_request/mod.rs +++ b/rtcp/src/transport_feedbacks/rapid_resynchronization_request/mod.rs @@ -65,7 +65,7 @@ impl Packet for RapidResynchronizationRequest { other .as_any() .downcast_ref::() - .map_or(false, |a| self == a) + == Some(self) } fn cloned(&self) -> Box { diff --git a/rtcp/src/transport_feedbacks/transport_layer_cc/mod.rs b/rtcp/src/transport_feedbacks/transport_layer_cc/mod.rs index 1637cc4e2..14014bf9d 100644 --- a/rtcp/src/transport_feedbacks/transport_layer_cc/mod.rs +++ b/rtcp/src/transport_feedbacks/transport_layer_cc/mod.rs @@ -507,10 +507,7 @@ impl Packet for TransportLayerCc { } fn equal(&self, other: &(dyn Packet + Send + Sync)) -> bool { - other - .as_any() - .downcast_ref::() - .map_or(false, |a| self == a) + other.as_any().downcast_ref::() == Some(self) } fn cloned(&self) -> Box { diff --git a/rtcp/src/transport_feedbacks/transport_layer_nack/mod.rs b/rtcp/src/transport_feedbacks/transport_layer_nack/mod.rs index 9482acd7e..dd63541de 100644 --- a/rtcp/src/transport_feedbacks/transport_layer_nack/mod.rs +++ b/rtcp/src/transport_feedbacks/transport_layer_nack/mod.rs @@ -154,10 +154,7 @@ impl Packet for TransportLayerNack { } fn equal(&self, other: &(dyn Packet + Send + Sync)) -> bool { - other - .as_any() - .downcast_ref::() - .map_or(false, |a| self == a) + other.as_any().downcast_ref::() == Some(self) } fn cloned(&self) -> Box { diff --git a/srtp/src/session/mod.rs b/srtp/src/session/mod.rs index 81edefe32..491911aa2 100644 --- a/srtp/src/session/mod.rs +++ b/srtp/src/session/mod.rs @@ -28,6 +28,7 @@ const DEFAULT_SESSION_SRTCP_REPLAY_PROTECTION_WINDOW: usize = 64; pub struct Session { local_context: Arc>, streams_map: Arc>>>, + #[allow(clippy::type_complexity)] new_stream_rx: Arc, Option)>>>, close_stream_tx: mpsc::Sender, close_session_tx: mpsc::Sender<()>, diff --git a/webrtc/src/rtp_transceiver/fmtp/generic/mod.rs b/webrtc/src/rtp_transceiver/fmtp/generic/mod.rs index 4b75ce350..4b62f2de2 100644 --- a/webrtc/src/rtp_transceiver/fmtp/generic/mod.rs +++ b/webrtc/src/rtp_transceiver/fmtp/generic/mod.rs @@ -53,10 +53,7 @@ impl Fmtp for GenericFmtp { } fn equal(&self, other: &(dyn Fmtp)) -> bool { - other - .as_any() - .downcast_ref::() - .map_or(false, |a| self == a) + other.as_any().downcast_ref::() == Some(self) } fn as_any(&self) -> &(dyn Any) { diff --git a/webrtc/src/rtp_transceiver/fmtp/h264/mod.rs b/webrtc/src/rtp_transceiver/fmtp/h264/mod.rs index 22a5bf594..1d34302cf 100644 --- a/webrtc/src/rtp_transceiver/fmtp/h264/mod.rs +++ b/webrtc/src/rtp_transceiver/fmtp/h264/mod.rs @@ -90,10 +90,7 @@ impl Fmtp for H264Fmtp { } fn equal(&self, other: &(dyn Fmtp)) -> bool { - other - .as_any() - .downcast_ref::() - .map_or(false, |a| self == a) + other.as_any().downcast_ref::() == Some(self) } fn as_any(&self) -> &(dyn Any) {