From 095feb106527f956674f78611fd19307dd3cfa29 Mon Sep 17 00:00:00 2001 From: Gnome! Date: Mon, 9 Sep 2024 10:54:17 +0100 Subject: [PATCH] Fix clippy warnings (#251) --- src/driver/test_config.rs | 4 ++-- src/events/context/data/rtcp.rs | 3 ++- src/events/context/data/rtp.rs | 3 ++- src/input/codecs/opus.rs | 2 +- src/lib.rs | 12 ++++++------ 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/driver/test_config.rs b/src/driver/test_config.rs index 19aba9635..bd20b60ce 100644 --- a/src/driver/test_config.rs +++ b/src/driver/test_config.rs @@ -178,10 +178,10 @@ impl DriverTestHandle { OutputPacket::Rtp(p) => eprintln!("pkt: RTP[{}B]", p.len()), OutputPacket::Raw(OutputMessage::Silent) => eprintln!("pkt: Raw-Silent"), OutputPacket::Raw(OutputMessage::Passthrough(p)) => { - eprintln!("pkt: Raw-Passthrough[{}B]", p.len()) + eprintln!("pkt: Raw-Passthrough[{}B]", p.len()); }, OutputPacket::Raw(OutputMessage::Mixed(p)) => { - eprintln!("pkt: Raw-Mixed[{}B]", p.len()) + eprintln!("pkt: Raw-Mixed[{}B]", p.len()); }, } } diff --git a/src/events/context/data/rtcp.rs b/src/events/context/data/rtcp.rs index b882db1a6..2eede984f 100644 --- a/src/events/context/data/rtcp.rs +++ b/src/events/context/data/rtcp.rs @@ -4,7 +4,8 @@ use super::*; #[derive(Clone, Debug, Eq, PartialEq)] #[non_exhaustive] -/// Telemetry/statistics packet, received from another stream (detailed in `packet`). +/// Telemetry/statistics packet, received from another stream +/// /// `payload_offset` contains the true payload location within the raw packet's `payload()`, /// to allow manual decoding of `Rtcp` packet bodies. pub struct RtcpData { diff --git a/src/events/context/data/rtp.rs b/src/events/context/data/rtp.rs index 1b59cd5b5..4554fd396 100644 --- a/src/events/context/data/rtp.rs +++ b/src/events/context/data/rtp.rs @@ -4,7 +4,8 @@ use super::*; #[derive(Clone, Debug, Eq, PartialEq)] #[non_exhaustive] -/// Opus audio packet, received from another stream (detailed in `packet`). +/// Opus audio packet, received from another stream +/// /// `payload_offset` contains the true payload location within the raw packet's `payload()`, /// if extensions or raw packet data are required. pub struct RtpData { diff --git a/src/input/codecs/opus.rs b/src/input/codecs/opus.rs index 4f2e33d97..6f5bbe4ea 100644 --- a/src/input/codecs/opus.rs +++ b/src/input/codecs/opus.rs @@ -53,7 +53,7 @@ impl OpusDecoder { Err(OpusError::Opus(ErrorCode::BufferTooSmall)) => { // double the buffer size // correct behav would be to mirror the decoder logic in the udp_rx set. - let new_size = (self.rawbuf.len() * 2).min(std::i32::MAX as usize); + let new_size = (self.rawbuf.len() * 2).min(i32::MAX as usize); if new_size == self.rawbuf.len() { return decode_error("Opus frame too big: cannot expand opus frame decode buffer any further."); } diff --git a/src/lib.rs b/src/lib.rs index da7f57748..66b21bb8d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -10,16 +10,16 @@ //! Songbird is an async, cross-library compatible voice system for Discord, written in Rust. //! The library offers: //! * A standalone gateway frontend compatible with [serenity] and [twilight] using the -//! `"gateway"` and `"[serenity/twilight]"` plus `"[rustls/native]"` features. You can even run -//! driverless, to help manage your [lavalink] sessions. +//! `"gateway"` and `"[serenity/twilight]"` plus `"[rustls/native]"` features. You can even run +//! driverless, to help manage your [lavalink] sessions. //! * A standalone driver for voice calls, via the `"driver"` feature. If you can create -//! a `ConnectionInfo` using any other gateway, or language for your bot, then you -//! can run the songbird voice driver. +//! a `ConnectionInfo` using any other gateway, or language for your bot, then you +//! can run the songbird voice driver. //! * Voice receive and RT(C)P packet handling via the `"receive"` feature. //! * SIMD-accelerated JSON decoding via the `"simd-json"` feature. //! * And, by default, a fully featured voice system featuring events, queues, -//! seeking on compatible streams, shared multithreaded audio stream caches, -//! and direct Opus data passthrough from DCA files. +//! seeking on compatible streams, shared multithreaded audio stream caches, +//! and direct Opus data passthrough from DCA files. //! //! ## Intents //! Songbird's gateway functionality requires you to specify the `GUILD_VOICE_STATES` intent.