1
0
Fork 0
mirror of https://github.com/librespot-org/librespot.git synced 2025-10-06 03:50:06 +02:00

Fix clippy warnings

This commit is contained in:
johannesd3 2021-04-10 14:06:41 +02:00
parent a576194b0e
commit b4f9ae31e2
12 changed files with 44 additions and 52 deletions

View file

@ -36,24 +36,21 @@ macro_rules! convert_samples_to {
};
}
pub struct SamplesConverter {}
impl SamplesConverter {
pub fn to_s32(samples: &[f32]) -> Vec<i32> {
convert_samples_to!(i32, samples)
}
pub fn to_s24(samples: &[f32]) -> Vec<i32> {
convert_samples_to!(i32, samples, 8)
}
pub fn to_s24_3(samples: &[f32]) -> Vec<i24> {
Self::to_s32(samples)
.iter()
.map(|sample| i24::pcm_from_i32(*sample))
.collect()
}
pub fn to_s16(samples: &[f32]) -> Vec<i16> {
convert_samples_to!(i16, samples)
}
pub fn to_s32(samples: &[f32]) -> Vec<i32> {
convert_samples_to!(i32, samples)
}
pub fn to_s24(samples: &[f32]) -> Vec<i32> {
convert_samples_to!(i32, samples, 8)
}
pub fn to_s24_3(samples: &[f32]) -> Vec<i24> {
to_s32(samples)
.iter()
.map(|sample| i24::pcm_from_i32(*sample))
.collect()
}
pub fn to_s16(samples: &[f32]) -> Vec<i16> {
convert_samples_to!(i16, samples)
}

View file

@ -3,7 +3,7 @@
#[macro_use]
extern crate log;
mod convert;
pub mod convert;
mod decrypt;
mod fetch;
@ -24,7 +24,6 @@ pub use passthrough_decoder::{PassthroughDecoder, PassthroughError};
mod range_set;
pub use convert::{i24, SamplesConverter};
pub use decrypt::AudioDecrypt;
pub use fetch::{AudioFile, StreamLoaderController};
pub use fetch::{