Chore: Rust 1.72.0 Clippy lints, adjust MSRV
MSRV was bumped by serenity-next, and so we too must follow suit.
This commit is contained in:
@@ -10,7 +10,7 @@ license = "ISC"
|
|||||||
name = "songbird"
|
name = "songbird"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
repository = "https://github.com/serenity-rs/songbird.git"
|
repository = "https://github.com/serenity-rs/songbird.git"
|
||||||
rust-version = "1.68.2"
|
rust-version = "1.72"
|
||||||
version = "0.3.2"
|
version = "0.3.2"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
@@ -94,5 +94,5 @@ Songbird's logo is based upon the copyright-free image ["Black-Capped Chickadee"
|
|||||||
[crates.io link]: https://crates.io/crates/songbird
|
[crates.io link]: https://crates.io/crates/songbird
|
||||||
[crates.io version]: https://img.shields.io/crates/v/songbird.svg?style=flat-square
|
[crates.io version]: https://img.shields.io/crates/v/songbird.svg?style=flat-square
|
||||||
|
|
||||||
[rust badge]: https://img.shields.io/badge/rust-1.68.2+-93450a.svg?style=flat-square
|
[rust badge]: https://img.shields.io/badge/rust-1.72+-93450a.svg?style=flat-square
|
||||||
[rust link]: https://blog.rust-lang.org/2023/03/28/Rust-1.68.2.html
|
[rust link]: https://blog.rust-lang.org/2023/08/24/Rust-1.72.0.html
|
||||||
|
|||||||
@@ -307,7 +307,7 @@ where
|
|||||||
if source_mono {
|
if source_mono {
|
||||||
// mix this signal into *all* output channels at req'd volume.
|
// mix this signal into *all* output channels at req'd volume.
|
||||||
let source_plane = source_raw_planes[0];
|
let source_plane = source_raw_planes[0];
|
||||||
for d_plane in (*target.planes_mut().planes()).iter_mut() {
|
for d_plane in &mut (*target.planes_mut().planes()) {
|
||||||
for (d, s) in d_plane[dest_pos..dest_pos + mix_ct]
|
for (d, s) in d_plane[dest_pos..dest_pos + mix_ct]
|
||||||
.iter_mut()
|
.iter_mut()
|
||||||
.zip(source_plane[source_pos..source_pos + mix_ct].iter())
|
.zip(source_plane[source_pos..source_pos + mix_ct].iter())
|
||||||
@@ -321,7 +321,7 @@ where
|
|||||||
let vol_adj = 1.0 / (source_chans as f32);
|
let vol_adj = 1.0 / (source_chans as f32);
|
||||||
let mut t_planes = target.planes_mut();
|
let mut t_planes = target.planes_mut();
|
||||||
let d_plane = &mut *t_planes.planes()[0];
|
let d_plane = &mut *t_planes.planes()[0];
|
||||||
for s_plane in source_raw_planes[..].iter() {
|
for s_plane in source_raw_planes {
|
||||||
for (d, s) in d_plane[dest_pos..dest_pos + mix_ct]
|
for (d, s) in d_plane[dest_pos..dest_pos + mix_ct]
|
||||||
.iter_mut()
|
.iter_mut()
|
||||||
.zip(s_plane[source_pos..source_pos + mix_ct].iter())
|
.zip(s_plane[source_pos..source_pos + mix_ct].iter())
|
||||||
@@ -364,7 +364,7 @@ fn mix_resampled(
|
|||||||
// see `mix_symph_buffer` for explanations of stereo<->mono logic.
|
// see `mix_symph_buffer` for explanations of stereo<->mono logic.
|
||||||
if source_mono {
|
if source_mono {
|
||||||
let source_plane = &source[0];
|
let source_plane = &source[0];
|
||||||
for d_plane in (*target.planes_mut().planes()).iter_mut() {
|
for d_plane in &mut (*target.planes_mut().planes()) {
|
||||||
for (d, s) in d_plane[dest_pos..dest_pos + mix_ct]
|
for (d, s) in d_plane[dest_pos..dest_pos + mix_ct]
|
||||||
.iter_mut()
|
.iter_mut()
|
||||||
.zip(source_plane)
|
.zip(source_plane)
|
||||||
@@ -376,7 +376,7 @@ fn mix_resampled(
|
|||||||
let vol_adj = 1.0 / (source_chans as f32);
|
let vol_adj = 1.0 / (source_chans as f32);
|
||||||
let mut t_planes = target.planes_mut();
|
let mut t_planes = target.planes_mut();
|
||||||
let d_plane = &mut *t_planes.planes()[0];
|
let d_plane = &mut *t_planes.planes()[0];
|
||||||
for s_plane in source[..].iter() {
|
for s_plane in source {
|
||||||
for (d, s) in d_plane[dest_pos..dest_pos + mix_ct].iter_mut().zip(s_plane) {
|
for (d, s) in d_plane[dest_pos..dest_pos + mix_ct].iter_mut().zip(s_plane) {
|
||||||
*d += volume * vol_adj * s;
|
*d += volume * vol_adj * s;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -150,8 +150,10 @@ impl fmt::Debug for Partial {
|
|||||||
f.debug_struct("Partial")
|
f.debug_struct("Partial")
|
||||||
.field("channel_id", &self.channel_id)
|
.field("channel_id", &self.channel_id)
|
||||||
.field("endpoint", &self.endpoint)
|
.field("endpoint", &self.endpoint)
|
||||||
|
.field("guild_id", &self.guild_id)
|
||||||
.field("session_id", &self.session_id)
|
.field("session_id", &self.session_id)
|
||||||
.field("token_is_some", &self.token.is_some())
|
.field("token_is_some", &self.token.is_some())
|
||||||
|
.field("user_id", &self.user_id)
|
||||||
.finish()
|
.finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ use symphonia_core::{
|
|||||||
};
|
};
|
||||||
use tracing::{debug, trace};
|
use tracing::{debug, trace};
|
||||||
|
|
||||||
|
/// Configuration for a cached source.
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
/// Registry of audio codecs supported by the driver.
|
/// Registry of audio codecs supported by the driver.
|
||||||
///
|
///
|
||||||
@@ -81,6 +82,9 @@ impl Default for Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Config {
|
impl Config {
|
||||||
|
/// Generate a storage configuration given an estimated storage bitrate
|
||||||
|
/// `cost_per_sec` in bytes/s.
|
||||||
|
#[must_use]
|
||||||
pub fn default_from_cost(cost_per_sec: usize) -> Self {
|
pub fn default_from_cost(cost_per_sec: usize) -> Self {
|
||||||
let streamcatcher = default_config(cost_per_sec);
|
let streamcatcher = default_config(cost_per_sec);
|
||||||
Self {
|
Self {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ use crate::constants::*;
|
|||||||
use crate::input::utils;
|
use crate::input::utils;
|
||||||
use audiopus::Bitrate;
|
use audiopus::Bitrate;
|
||||||
use std::{mem, time::Duration};
|
use std::{mem, time::Duration};
|
||||||
use streamcatcher::{Config, GrowthStrategy};
|
use streamcatcher::{Config as ScConfig, GrowthStrategy};
|
||||||
|
|
||||||
/// Estimates the cost, in B/s, of audio data compressed at the given bitrate.
|
/// Estimates the cost, in B/s, of audio data compressed at the given bitrate.
|
||||||
#[must_use]
|
#[must_use]
|
||||||
@@ -44,6 +44,6 @@ pub fn raw_cost_per_sec(stereo: bool) -> usize {
|
|||||||
///
|
///
|
||||||
/// [`streamcatcher`]: https://docs.rs/streamcatcher/0.1.0/streamcatcher/struct.Config.html
|
/// [`streamcatcher`]: https://docs.rs/streamcatcher/0.1.0/streamcatcher/struct.Config.html
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn default_config(cost_per_sec: usize) -> Config {
|
pub fn default_config(cost_per_sec: usize) -> ScConfig {
|
||||||
Config::new().chunk_size(GrowthStrategy::Constant(5 * cost_per_sec))
|
ScConfig::new().chunk_size(GrowthStrategy::Constant(5 * cost_per_sec))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,6 +75,7 @@
|
|||||||
clippy::cast_possible_truncation,
|
clippy::cast_possible_truncation,
|
||||||
// TODO: would require significant rewriting of all existing docs
|
// TODO: would require significant rewriting of all existing docs
|
||||||
clippy::missing_errors_doc,
|
clippy::missing_errors_doc,
|
||||||
|
clippy::missing_panics_doc,
|
||||||
)]
|
)]
|
||||||
|
|
||||||
mod config;
|
mod config;
|
||||||
|
|||||||
Reference in New Issue
Block a user