Fix clippy warnings (#275)

This commit is contained in:
Gnome!
2025-05-05 13:58:15 +01:00
committed by GitHub
parent 64868e7213
commit 8956352f13
6 changed files with 18 additions and 17 deletions

View File

@@ -581,7 +581,7 @@ mod test {
// If there is no mutual intelligibility, return an error.
let bad_modes = ["not_real", "des", "rc5"];
assert!(CryptoMode::negotiate(&bad_modes, None).is_err());
assert!(CryptoMode::negotiate(&bad_modes, Some(CryptoMode::Aes256Gcm)).is_err());
assert!(CryptoMode::negotiate(bad_modes, None).is_err());
assert!(CryptoMode::negotiate(bad_modes, Some(CryptoMode::Aes256Gcm)).is_err());
}
}

View File

@@ -246,7 +246,7 @@ pub fn mix_symph_indiv(
resample_in_progress = true;
continue;
}
};
}
let samples_marched = mix_resampled(rs_out_buf, symph_mix, samples_written, volume);

View File

@@ -679,12 +679,11 @@ impl Mixer {
Ok(())
} else {
self._send_packet(packet)
self.send_packet_(packet)
};
#[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)?;
@@ -692,7 +691,7 @@ impl Mixer {
}
#[inline]
fn _send_packet(&self, packet: &[u8]) -> Result<()> {
fn send_packet_(&self, packet: &[u8]) -> Result<()> {
let conn = self
.conn_active
.as_ref()

View File

@@ -434,7 +434,7 @@ where
},
Err(e) => {
debug!("Read error {:?} {:?} {:?}.", e, out, raw_len);
out = Some(Err(IoError::new(IoErrorKind::Other, e)));
out = Some(Err(IoError::other(e)));
break;
},
}
@@ -472,7 +472,7 @@ where
// NOTE: use of raw_len here preserves true sample length even if
// stream is extended to 20ms boundary.
out.unwrap_or_else(|| Err(IoError::new(IoErrorKind::Other, "Unclear.")))
out.unwrap_or_else(|| Err(IoError::other("Unclear.")))
.map(|compressed_sz| {
self.audio_bytes
.fetch_add(raw_len * mem::size_of::<f32>(), Ordering::Release);

View File

@@ -132,8 +132,7 @@ impl HttpRequest {
});
let stream = Box::new(StreamReader::new(
resp.bytes_stream()
.map_err(|e| IoError::new(IoErrorKind::Other, e)),
resp.bytes_stream().map_err(IoError::other),
));
let input = HttpStream {

View File

@@ -10,15 +10,15 @@
//! 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.
//! * 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.
@@ -77,6 +77,9 @@
clippy::missing_panics_doc,
clippy::doc_link_with_quotes,
clippy::doc_markdown,
// Allowed as they cannot be fixed without breaking
clippy::result_large_err,
clippy::large_enum_variant,
)]
mod config;