Merge pull request #563 from RustAudio/clippy_warnings

This fixes all clippy warnings
This commit is contained in:
David Kleingeld 2024-03-26 18:19:30 +01:00 committed by GitHub
commit e0b8e9bb57
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 11 additions and 3 deletions

View file

@ -107,7 +107,7 @@ where
// Load the next block.
self.current_block_off = 0;
let buffer = mem::replace(&mut self.current_block, Vec::new());
let buffer = mem::take(&mut self.current_block);
match self.reader.blocks().read_next_or_eof(buffer) {
Ok(Some(block)) => {
self.current_block_channel_len = (block.len() / block.channels()) as usize;

View file

@ -39,6 +39,9 @@ pub struct LoopedDecoder<R>(DecoderImpl<R>)
where
R: Read + Seek;
// can not really reduce the size of the VorbisDecoder. There are not any
// arrays just a lot of struct fields.
#[allow(clippy::large_enum_variant)]
enum DecoderImpl<R>
where
R: Read + Seek,

View file

@ -43,9 +43,12 @@ where
// TODO: consider reimplementing this with `from_factory`
type Sound<S> = Box<dyn Source<Item = S> + Send>;
type SignalDone = Option<Sender<()>>;
/// The input of the queue.
pub struct SourcesQueueInput<S> {
next_sounds: Mutex<Vec<(Box<dyn Source<Item = S> + Send>, Option<Sender<()>>)>>,
next_sounds: Mutex<Vec<(Sound<S>, SignalDone)>>,
// See constructor.
keep_alive_if_empty: AtomicBool,

View file

@ -226,6 +226,7 @@ impl Sink {
}
/// Returns the number of sounds currently in the queue.
#[allow(clippy::len_without_is_empty)]
#[inline]
pub fn len(&self) -> usize {
self.sound_count.load(Ordering::Relaxed)

View file

@ -17,7 +17,7 @@ impl SineWave {
#[inline]
pub fn new(freq: f32) -> SineWave {
SineWave {
freq: freq,
freq,
num_sample: 0,
}
}

View file

@ -168,6 +168,7 @@ impl SpatialSink {
}
/// Returns the number of sounds currently in the queue.
#[allow(clippy::len_without_is_empty)]
#[inline]
pub fn len(&self) -> usize {
self.sink.len()