Skip to content

Commit

Permalink
Chore: Clippy fixes to match new MSRV.
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixMcFelix committed Nov 20, 2023
1 parent 1bf17d1 commit 9fa063f
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 34 deletions.
15 changes: 3 additions & 12 deletions src/driver/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,7 @@ impl Connection {
.await?;

loop {
let value = match client.recv_json().await? {
Some(value) => value,
None => continue,
};
let Some(value) = client.recv_json().await? else { continue };

match value {
GatewayEvent::Ready(r) => {
Expand Down Expand Up @@ -282,10 +279,7 @@ impl Connection {
let mut resumed = None;

loop {
let value = match client.recv_json().await? {
Some(value) => value,
None => continue,
};
let Some(value) = client.recv_json().await? else { continue };

match value {
GatewayEvent::Resumed => {
Expand Down Expand Up @@ -337,10 +331,7 @@ fn generate_url(endpoint: &mut String) -> Result<Url> {
#[inline]
async fn init_cipher(client: &mut WsStream, mode: CryptoMode) -> Result<Cipher> {
loop {
let value = match client.recv_json().await? {
Some(value) => value,
None => continue,
};
let Some(value) = client.recv_json().await? else { continue };

match value {
GatewayEvent::SessionDescription(desc) => {
Expand Down
4 changes: 2 additions & 2 deletions src/driver/scheduler/live.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ impl Live {

if let Some((id, parked)) = self.remove_task(i) {
self.global_stats.move_mixer_to_idle();
let _ = self.tx.send(SchedulerMessage::Demote(id, parked));
_ = self.tx.send(SchedulerMessage::Demote(id, parked));
} else {
self.global_stats.remove_live_mixer();
}
Expand All @@ -445,7 +445,7 @@ impl Live {
if let Some((id, mut parked)) = self.remove_task(idx) {
self.global_stats.move_mixer_to_idle();
parked.last_cost = Some(cost);
let _ = self
_ = self
.tx
.send(SchedulerMessage::Overspill(self.id, id, parked));
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/driver/tasks/mixer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ impl Mixer {
input,
mix_state,
vol,
do_passthrough.then(|| &mut *opus_frame),
do_passthrough.then_some(&mut *opus_frame),
);

let return_here = if let MixType::MixedPcm(pcm_len) = mix_type {
Expand Down
2 changes: 1 addition & 1 deletion src/driver/tasks/udp_rx/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ impl UdpRx {
}
};

let _ = self.ssrc_signalling.disconnected_users.remove(&id);
_ = self.ssrc_signalling.disconnected_users.remove(&id);
if let Some((_, ssrc)) = self.ssrc_signalling.user_ssrc_map.remove(&id) {
if let Some(state) = self.decoder_map.get_mut(&ssrc) {
// don't cleanup immediately: leave for later cycle
Expand Down
2 changes: 1 addition & 1 deletion src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ impl Call {
#[cfg(feature = "driver")]
Some((ConnectionProgress::Complete(c), Return::Conn(first_tx, driver_tx))) => {
// It's okay if the receiver hung up.
let _ = first_tx.send(());
_ = first_tx.send(());

self.driver.raw_connect(c.clone(), driver_tx.clone());
},
Expand Down
8 changes: 4 additions & 4 deletions src/input/adapters/async_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ impl AsyncAdapterStream {
self.resp_rx.try_recv().ok()
};

let msg = if let Some(msg) = msg { msg } else { break None };
let Some(msg) = msg else { break None };

// state changes
match &msg {
Expand Down Expand Up @@ -267,7 +267,7 @@ impl Seek for AsyncAdapterStream {

self.check_dropped()?;

let _ = self.req_tx.send(AdapterRequest::Seek(pos));
_ = self.req_tx.send(AdapterRequest::Seek(pos));

// wait for async to tell us that it has stopped writing,
// then clear buf and allow async to write again.
Expand All @@ -280,7 +280,7 @@ impl Seek for AsyncAdapterStream {

self.bytes_out.skip(self.bytes_out.capacity());

let _ = self.req_tx.send(AdapterRequest::SeekCleared);
_ = self.req_tx.send(AdapterRequest::SeekCleared);

match self.handle_messages(Operation::Seek) {
Some(AdapterResponse::SeekResult(a)) => a,
Expand All @@ -298,7 +298,7 @@ impl MediaSource for AsyncAdapterStream {
fn byte_len(&self) -> Option<u64> {
self.check_dropped().ok()?;

let _ = self.req_tx.send(AdapterRequest::ByteLen);
_ = self.req_tx.send(AdapterRequest::ByteLen);

match self.handle_messages(Operation::Len) {
Some(AdapterResponse::ByteLen(a)) => a,
Expand Down
4 changes: 1 addition & 3 deletions src/input/adapters/cached/compressed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,7 @@ impl Compressed {
.await??;

// If success, guaranteed to be Parsed
let mut parsed = if let LiveInput::Parsed(parsed) = promoted {
parsed
} else {
let LiveInput::Parsed(mut parsed) = promoted else {
unreachable!()
};

Expand Down
4 changes: 1 addition & 3 deletions src/input/adapters/cached/decompressed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ impl Decompressed {
.await??;

// If success, guaranteed to be Parsed
let parsed = if let LiveInput::Parsed(parsed) = promoted {
parsed
} else {
let LiveInput::Parsed(parsed) = promoted else {
unreachable!()
};

Expand Down
2 changes: 1 addition & 1 deletion src/input/codecs/opus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ impl Decoder for OpusDecoder {
}

fn reset(&mut self) {
let _ = self.inner.reset_state();
_ = self.inner.reset_state();
}

fn finalize(&mut self) -> FinalizeResult {
Expand Down
8 changes: 2 additions & 6 deletions src/tracks/mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ use crate::events::TrackEvent;
/// Playback status of a track.
#[derive(Clone, Debug)]
#[non_exhaustive]
#[derive(Default)]
pub enum PlayMode {
/// The track is currently playing.
#[default]
Play,
/// The track is currently paused, and may be resumed.
Pause,
Expand Down Expand Up @@ -67,12 +69,6 @@ impl PlayMode {
}
}

impl Default for PlayMode {
fn default() -> Self {
PlayMode::Play
}
}

impl PartialEq for PlayMode {
fn eq(&self, other: &Self) -> bool {
self.as_track_event() == other.as_track_event()
Expand Down

0 comments on commit 9fa063f

Please sign in to comment.