diff --git a/dtls/src/conn/mod.rs b/dtls/src/conn/mod.rs index df89b388a..6d4a7d300 100644 --- a/dtls/src/conn/mod.rs +++ b/dtls/src/conn/mod.rs @@ -449,9 +449,7 @@ impl DTLSConn { tokio::select! { result = self.write_packets(pkts) => { - if let Err(err) = result { - return Err(err); - } + result?; } _ = timer.as_mut() => return Err(Error::ErrDeadlineExceeded), } diff --git a/turn/src/client/relay_conn.rs b/turn/src/client/relay_conn.rs index 386f815a0..2908b72f8 100644 --- a/turn/src/client/relay_conn.rs +++ b/turn/src/client/relay_conn.rs @@ -228,9 +228,7 @@ impl RelayConnInternal { } } } - if let Err(err) = result { - return Err(err); - } + result?; let number = { let (bind_st, bind_at, bind_number, bind_addr) = { diff --git a/turn/src/server/request.rs b/turn/src/server/request.rs index fb1815edf..25c178191 100644 --- a/turn/src/server/request.rs +++ b/turn/src/server/request.rs @@ -850,11 +850,9 @@ pub(crate) async fn build_and_send_err( msg: Message, err: Error, ) -> Result<()> { - if let Err(send_err) = build_and_send(conn, dst, msg).await { - Err(send_err) - } else { - Err(err) - } + build_and_send(conn, dst, msg).await?; + + Err(err) } pub(crate) fn build_msg( diff --git a/util/src/vnet/net.rs b/util/src/vnet/net.rs index 6aba50fa3..41c1a4edf 100644 --- a/util/src/vnet/net.rs +++ b/util/src/vnet/net.rs @@ -44,12 +44,7 @@ pub(crate) struct VNetInternal { impl VNetInternal { fn get_interface(&self, ifc_name: &str) -> Option<&Interface> { - for ifc in &self.interfaces { - if ifc.name == ifc_name { - return Some(ifc); - } - } - None + self.interfaces.iter().find(|ifc| ifc.name == ifc_name) } } diff --git a/webrtc/src/peer_connection/peer_connection_internal.rs b/webrtc/src/peer_connection/peer_connection_internal.rs index 81dab00ab..5c0539ef4 100644 --- a/webrtc/src/peer_connection/peer_connection_internal.rs +++ b/webrtc/src/peer_connection/peer_connection_internal.rs @@ -920,6 +920,11 @@ impl PeerConnectionInternal { sender.set_negotiated(); } let media_transceivers = vec![t]; + + // NB: The below could use `then_some`, but with our current MSRV + // it's not possible to actually do this. The clippy version that + // ships with 1.64.0 complains about this so we disable it for now. + #[allow(clippy::unnecessary_lazy_evaluations)] media_sections.push(MediaSection { id: mid_value.to_owned(), transceivers: media_transceivers,