Skip to content

Commit c9409ba

Browse files
Fix clippy warning (#301)
1 parent 3227eba commit c9409ba

File tree

5 files changed

+11
-17
lines changed

5 files changed

+11
-17
lines changed

dtls/src/conn/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -449,9 +449,7 @@ impl DTLSConn {
449449

450450
tokio::select! {
451451
result = self.write_packets(pkts) => {
452-
if let Err(err) = result {
453-
return Err(err);
454-
}
452+
result?;
455453
}
456454
_ = timer.as_mut() => return Err(Error::ErrDeadlineExceeded),
457455
}

turn/src/client/relay_conn.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,7 @@ impl<T: RelayConnObserver + Send + Sync> RelayConnInternal<T> {
228228
}
229229
}
230230
}
231-
if let Err(err) = result {
232-
return Err(err);
233-
}
231+
result?;
234232

235233
let number = {
236234
let (bind_st, bind_at, bind_number, bind_addr) = {

turn/src/server/request.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -850,11 +850,9 @@ pub(crate) async fn build_and_send_err(
850850
msg: Message,
851851
err: Error,
852852
) -> Result<()> {
853-
if let Err(send_err) = build_and_send(conn, dst, msg).await {
854-
Err(send_err)
855-
} else {
856-
Err(err)
857-
}
853+
build_and_send(conn, dst, msg).await?;
854+
855+
Err(err)
858856
}
859857

860858
pub(crate) fn build_msg(

util/src/vnet/net.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,7 @@ pub(crate) struct VNetInternal {
4444

4545
impl VNetInternal {
4646
fn get_interface(&self, ifc_name: &str) -> Option<&Interface> {
47-
for ifc in &self.interfaces {
48-
if ifc.name == ifc_name {
49-
return Some(ifc);
50-
}
51-
}
52-
None
47+
self.interfaces.iter().find(|ifc| ifc.name == ifc_name)
5348
}
5449
}
5550

webrtc/src/peer_connection/peer_connection_internal.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -920,6 +920,11 @@ impl PeerConnectionInternal {
920920
sender.set_negotiated();
921921
}
922922
let media_transceivers = vec![t];
923+
924+
// NB: The below could use `then_some`, but with our current MSRV
925+
// it's not possible to actually do this. The clippy version that
926+
// ships with 1.64.0 complains about this so we disable it for now.
927+
#[allow(clippy::unnecessary_lazy_evaluations)]
923928
media_sections.push(MediaSection {
924929
id: mid_value.to_owned(),
925930
transceivers: media_transceivers,

0 commit comments

Comments
 (0)