Skip to content

Commit

Permalink
Fix clippy warning (#301)
Browse files Browse the repository at this point in the history
  • Loading branch information
lookback-hugotunius authored Sep 29, 2022
1 parent 3227eba commit c9409ba
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 17 deletions.
4 changes: 1 addition & 3 deletions dtls/src/conn/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
Expand Down
4 changes: 1 addition & 3 deletions turn/src/client/relay_conn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,7 @@ impl<T: RelayConnObserver + Send + Sync> RelayConnInternal<T> {
}
}
}
if let Err(err) = result {
return Err(err);
}
result?;

let number = {
let (bind_st, bind_at, bind_number, bind_addr) = {
Expand Down
8 changes: 3 additions & 5 deletions turn/src/server/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
7 changes: 1 addition & 6 deletions util/src/vnet/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down
5 changes: 5 additions & 0 deletions webrtc/src/peer_connection/peer_connection_internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit c9409ba

Please sign in to comment.