Chore: clippy appeasement

This commit is contained in:
Kyle Simpson
2025-02-21 14:05:59 +00:00
parent 5d320a394b
commit 47cf0b27eb
9 changed files with 25 additions and 21 deletions

View File

@@ -5,7 +5,7 @@ authors = ["my name <my@email.address>"]
edition = "2021" edition = "2021"
[dependencies] [dependencies]
dashmap = "5" dashmap = "6"
serenity = { workspace = true } serenity = { workspace = true }
songbird = { workspace = true, default-features = true, features = ["receive"] } songbird = { workspace = true, default-features = true, features = ["receive"] }
symphonia = { workspace = true } symphonia = { workspace = true }

View File

@@ -1,4 +1,5 @@
//! Encryption schemes supported by Discord's secure RTP negotiation. //! Encryption schemes supported by Discord's secure RTP negotiation.
#[cfg(any(feature = "receive", test))]
use super::tasks::error::Error as InternalError; use super::tasks::error::Error as InternalError;
use aead::AeadCore; use aead::AeadCore;
use aes_gcm::{AeadInPlace, Aes256Gcm, KeyInit}; use aes_gcm::{AeadInPlace, Aes256Gcm, KeyInit};

View File

@@ -327,6 +327,7 @@ impl Live {
return; return;
} }
#[allow(clippy::used_underscore_items)]
self._march_deadline(); self._march_deadline();
} }

View File

@@ -683,6 +683,7 @@ impl Mixer {
}; };
#[cfg(not(test))] #[cfg(not(test))]
#[allow(clippy::used_underscore_items)]
let send_status = self._send_packet(packet); let send_status = self._send_packet(packet);
send_status.or_else(Error::disarm_would_block)?; send_status.or_else(Error::disarm_would_block)?;

View File

@@ -97,7 +97,7 @@ impl EventStore {
/// Processes all events due up to and including `now`. /// Processes all events due up to and including `now`.
pub(crate) fn timed_event_ready(&self, now: Duration) -> bool { 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 evt.fire_time
.as_ref() .as_ref()
.expect("Timed event must have a fire_time.") .expect("Timed event must have a fire_time.")

View File

@@ -219,11 +219,11 @@ impl Call {
where where
C: Into<ChannelId> + Debug, C: Into<ChannelId> + Debug,
{ {
self._join(channel_id.into()).await self.join_inner(channel_id.into()).await
} }
#[cfg(feature = "driver")] #[cfg(feature = "driver")]
async fn _join(&mut self, channel_id: ChannelId) -> JoinResult<Join> { async fn join_inner(&mut self, channel_id: ChannelId) -> JoinResult<Join> {
let (tx, rx) = flume::unbounded(); let (tx, rx) = flume::unbounded();
let (gw_tx, gw_rx) = flume::unbounded(); let (gw_tx, gw_rx) = flume::unbounded();
@@ -280,10 +280,10 @@ impl Call {
where where
C: Into<ChannelId> + Debug, C: Into<ChannelId> + 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<JoinGateway> { async fn join_gateway_inner(&mut self, channel_id: ChannelId) -> JoinResult<JoinGateway> {
let (tx, rx) = flume::unbounded(); let (tx, rx) = flume::unbounded();
let do_conn = self let do_conn = self
@@ -414,10 +414,10 @@ impl Call {
where where
C: Into<ChannelId> + Debug, C: Into<ChannelId> + 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<ChannelId>) { fn update_state_inner(&mut self, session_id: String, channel_id: Option<ChannelId>) {
if let Some(channel_id) = channel_id { if let Some(channel_id) = channel_id {
let try_conn = if let Some((ref mut progress, _)) = self.connection.as_mut() { let try_conn = if let Some((ref mut progress, _)) = self.connection.as_mut() {
progress.apply_state_update(session_id, channel_id) progress.apply_state_update(session_id, channel_id)

View File

@@ -35,7 +35,7 @@ struct AsyncAdapterSink {
impl AsyncAdapterSink { impl AsyncAdapterSink {
async fn launch(mut self) { 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 read_region = 0..0;
let mut hit_end = false; let mut hit_end = false;
let mut blocked = false; let mut blocked = false;

View File

@@ -192,7 +192,7 @@ impl From<YoutubeDl<'static>> for Input {
} }
#[async_trait] #[async_trait]
impl<'a> Compose for YoutubeDl<'a> { impl Compose for YoutubeDl<'_> {
fn create(&mut self) -> Result<AudioStream<Box<dyn MediaSource>>, AudioStreamError> { fn create(&mut self) -> Result<AudioStream<Box<dyn MediaSource>>, AudioStreamError> {
Err(AudioStreamError::Unsupported) Err(AudioStreamError::Unsupported)
} }

View File

@@ -154,10 +154,10 @@ impl Songbird {
where where
G: Into<GuildId>, G: Into<GuildId>,
{ {
self._get_or_insert(guild_id.into()) self.get_or_insert_inner(guild_id.into())
} }
fn _get_or_insert(&self, guild_id: GuildId) -> Arc<Mutex<Call>> { fn get_or_insert_inner(&self, guild_id: GuildId) -> Arc<Mutex<Call>> {
self.get(guild_id).unwrap_or_else(|| { self.get(guild_id).unwrap_or_else(|| {
self.calls self.calls
.entry(guild_id) .entry(guild_id)
@@ -235,11 +235,11 @@ impl Songbird {
C: Into<ChannelId>, C: Into<ChannelId>,
G: Into<GuildId>, G: Into<GuildId>,
{ {
self._join(guild_id.into(), channel_id.into()).await self.join_inner(guild_id.into(), channel_id.into()).await
} }
#[cfg(feature = "driver")] #[cfg(feature = "driver")]
async fn _join( async fn join_inner(
&self, &self,
guild_id: GuildId, guild_id: GuildId,
channel_id: ChannelId, channel_id: ChannelId,
@@ -277,10 +277,11 @@ impl Songbird {
C: Into<ChannelId>, C: Into<ChannelId>,
G: Into<GuildId>, G: Into<GuildId>,
{ {
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, &self,
guild_id: GuildId, guild_id: GuildId,
channel_id: ChannelId, channel_id: ChannelId,
@@ -318,10 +319,10 @@ impl Songbird {
/// [`remove`]: Songbird::remove /// [`remove`]: Songbird::remove
#[inline] #[inline]
pub async fn leave<G: Into<GuildId>>(&self, guild_id: G) -> JoinResult<()> { pub async fn leave<G: Into<GuildId>>(&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) { if let Some(call) = self.get(guild_id) {
let mut handler = call.lock().await; let mut handler = call.lock().await;
handler.leave().await handler.leave().await
@@ -341,10 +342,10 @@ impl Songbird {
/// [`Call`]: Call /// [`Call`]: Call
#[inline] #[inline]
pub async fn remove<G: Into<GuildId>>(&self, guild_id: G) -> JoinResult<()> { pub async fn remove<G: Into<GuildId>>(&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.leave(guild_id).await?;
self.calls.remove(&guild_id); self.calls.remove(&guild_id);
Ok(()) Ok(())
@@ -476,7 +477,7 @@ pub struct Iter<'a> {
inner: InnerIter<'a>, inner: InnerIter<'a>,
} }
impl<'a> Iterator for Iter<'a> { impl Iterator for Iter<'_> {
type Item = (GuildId, Arc<Mutex<Call>>); type Item = (GuildId, Arc<Mutex<Call>>);
fn next(&mut self) -> Option<Self::Item> { fn next(&mut self) -> Option<Self::Item> {