diff --git a/examples/serenity/voice_receive/Cargo.toml b/examples/serenity/voice_receive/Cargo.toml index eb3ead6..5d463ff 100644 --- a/examples/serenity/voice_receive/Cargo.toml +++ b/examples/serenity/voice_receive/Cargo.toml @@ -5,7 +5,7 @@ authors = ["my name "] edition = "2021" [dependencies] -dashmap = "5" +dashmap = "6" serenity = { workspace = true } songbird = { workspace = true, default-features = true, features = ["receive"] } symphonia = { workspace = true } diff --git a/src/driver/crypto.rs b/src/driver/crypto.rs index 9a54af2..395b456 100644 --- a/src/driver/crypto.rs +++ b/src/driver/crypto.rs @@ -1,4 +1,5 @@ //! Encryption schemes supported by Discord's secure RTP negotiation. +#[cfg(any(feature = "receive", test))] use super::tasks::error::Error as InternalError; use aead::AeadCore; use aes_gcm::{AeadInPlace, Aes256Gcm, KeyInit}; diff --git a/src/driver/scheduler/live.rs b/src/driver/scheduler/live.rs index 32e89fc..16b67df 100644 --- a/src/driver/scheduler/live.rs +++ b/src/driver/scheduler/live.rs @@ -327,6 +327,7 @@ impl Live { return; } + #[allow(clippy::used_underscore_items)] self._march_deadline(); } diff --git a/src/driver/tasks/mixer/mod.rs b/src/driver/tasks/mixer/mod.rs index e80ea3c..9f8ba0f 100644 --- a/src/driver/tasks/mixer/mod.rs +++ b/src/driver/tasks/mixer/mod.rs @@ -683,6 +683,7 @@ impl Mixer { }; #[cfg(not(test))] + #[allow(clippy::used_underscore_items)] let send_status = self._send_packet(packet); send_status.or_else(Error::disarm_would_block)?; diff --git a/src/events/store.rs b/src/events/store.rs index ff54be0..43a8fef 100644 --- a/src/events/store.rs +++ b/src/events/store.rs @@ -97,7 +97,7 @@ impl EventStore { /// Processes all events due up to and including `now`. pub(crate) fn timed_event_ready(&self, now: Duration) -> bool { - self.timed.peek().map_or(false, |evt| { + self.timed.peek().is_some_and(|evt| { evt.fire_time .as_ref() .expect("Timed event must have a fire_time.") diff --git a/src/handler.rs b/src/handler.rs index 1e6eb44..fd085b4 100644 --- a/src/handler.rs +++ b/src/handler.rs @@ -219,11 +219,11 @@ impl Call { where C: Into + Debug, { - self._join(channel_id.into()).await + self.join_inner(channel_id.into()).await } #[cfg(feature = "driver")] - async fn _join(&mut self, channel_id: ChannelId) -> JoinResult { + async fn join_inner(&mut self, channel_id: ChannelId) -> JoinResult { let (tx, rx) = flume::unbounded(); let (gw_tx, gw_rx) = flume::unbounded(); @@ -280,10 +280,10 @@ impl Call { where C: Into + Debug, { - self._join_gateway(channel_id.into()).await + self.join_gateway_inner(channel_id.into()).await } - async fn _join_gateway(&mut self, channel_id: ChannelId) -> JoinResult { + async fn join_gateway_inner(&mut self, channel_id: ChannelId) -> JoinResult { let (tx, rx) = flume::unbounded(); let do_conn = self @@ -414,10 +414,10 @@ impl Call { where C: Into + Debug, { - self._update_state(session_id, channel_id.map(Into::into)); + self.update_state_inner(session_id, channel_id.map(Into::into)); } - fn _update_state(&mut self, session_id: String, channel_id: Option) { + fn update_state_inner(&mut self, session_id: String, channel_id: Option) { if let Some(channel_id) = channel_id { let try_conn = if let Some((ref mut progress, _)) = self.connection.as_mut() { progress.apply_state_update(session_id, channel_id) diff --git a/src/input/adapters/async_adapter.rs b/src/input/adapters/async_adapter.rs index 0a8b32b..7848f19 100644 --- a/src/input/adapters/async_adapter.rs +++ b/src/input/adapters/async_adapter.rs @@ -35,7 +35,7 @@ struct AsyncAdapterSink { impl AsyncAdapterSink { async fn launch(mut self) { - let mut inner_buf = [0u8; 32 * 1024]; + let mut inner_buf = vec![0u8; 32 * 1024].into_boxed_slice(); let mut read_region = 0..0; let mut hit_end = false; let mut blocked = false; diff --git a/src/input/sources/ytdl.rs b/src/input/sources/ytdl.rs index 4183f06..a51341f 100644 --- a/src/input/sources/ytdl.rs +++ b/src/input/sources/ytdl.rs @@ -192,7 +192,7 @@ impl From> for Input { } #[async_trait] -impl<'a> Compose for YoutubeDl<'a> { +impl Compose for YoutubeDl<'_> { fn create(&mut self) -> Result>, AudioStreamError> { Err(AudioStreamError::Unsupported) } diff --git a/src/manager.rs b/src/manager.rs index 7521937..9e33b8e 100644 --- a/src/manager.rs +++ b/src/manager.rs @@ -154,10 +154,10 @@ impl Songbird { where G: Into, { - self._get_or_insert(guild_id.into()) + self.get_or_insert_inner(guild_id.into()) } - fn _get_or_insert(&self, guild_id: GuildId) -> Arc> { + fn get_or_insert_inner(&self, guild_id: GuildId) -> Arc> { self.get(guild_id).unwrap_or_else(|| { self.calls .entry(guild_id) @@ -235,11 +235,11 @@ impl Songbird { C: Into, G: Into, { - self._join(guild_id.into(), channel_id.into()).await + self.join_inner(guild_id.into(), channel_id.into()).await } #[cfg(feature = "driver")] - async fn _join( + async fn join_inner( &self, guild_id: GuildId, channel_id: ChannelId, @@ -277,10 +277,11 @@ impl Songbird { C: Into, G: Into, { - self._join_gateway(guild_id.into(), channel_id.into()).await + self.join_gateway_inner(guild_id.into(), channel_id.into()) + .await } - async fn _join_gateway( + async fn join_gateway_inner( &self, guild_id: GuildId, channel_id: ChannelId, @@ -318,10 +319,10 @@ impl Songbird { /// [`remove`]: Songbird::remove #[inline] pub async fn leave>(&self, guild_id: G) -> JoinResult<()> { - self._leave(guild_id.into()).await + self.leave_inner(guild_id.into()).await } - async fn _leave(&self, guild_id: GuildId) -> JoinResult<()> { + async fn leave_inner(&self, guild_id: GuildId) -> JoinResult<()> { if let Some(call) = self.get(guild_id) { let mut handler = call.lock().await; handler.leave().await @@ -341,10 +342,10 @@ impl Songbird { /// [`Call`]: Call #[inline] pub async fn remove>(&self, guild_id: G) -> JoinResult<()> { - self._remove(guild_id.into()).await + self.remove_inner(guild_id.into()).await } - async fn _remove(&self, guild_id: GuildId) -> JoinResult<()> { + async fn remove_inner(&self, guild_id: GuildId) -> JoinResult<()> { self.leave(guild_id).await?; self.calls.remove(&guild_id); Ok(()) @@ -476,7 +477,7 @@ pub struct Iter<'a> { inner: InnerIter<'a>, } -impl<'a> Iterator for Iter<'a> { +impl Iterator for Iter<'_> { type Item = (GuildId, Arc>); fn next(&mut self) -> Option {