diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 2c607d7..751ef1a 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -64,6 +64,6 @@ jobs: - name: rustfmt run: cargo fmt -- --check - name: Clippy - run: cargo clippy --all-targets + run: cargo clippy --all-targets --all-features - name: Rustdoc - run: cargo doc --no-deps --document-private-items + run: cargo doc --no-deps --document-private-items --all-features diff --git a/src/audio_history.rs b/src/audio_history.rs index 17e2bfc..23bc88f 100644 --- a/src/audio_history.rs +++ b/src/audio_history.rs @@ -260,7 +260,7 @@ mod tests { let mut hist = AudioHistory::new(2.0); assert_eq!(hist.total_consumed_samples, 0); - hist.update([0.0].iter().copied()); + hist.update(core::iter::once(0.0)); assert_eq!(hist.total_consumed_samples, 1); assert_eq!(hist.passed_time(), Duration::from_secs_f32(0.5)); @@ -357,12 +357,12 @@ mod tests { fn sample_info() { let mut hist = AudioHistory::new(1.0); - hist.update([0.0].iter().copied()); + hist.update(core::iter::once(0.0)); assert_eq!( hist.index_to_sample_info(0).duration_behind, Duration::from_secs(0) ); - hist.update([0.0].iter().copied()); + hist.update(core::iter::once(0.0)); assert_eq!( hist.index_to_sample_info(0).duration_behind, Duration::from_secs(1) @@ -430,11 +430,11 @@ mod tests { let mut history = AudioHistory::new(1.0); for i in 0..history.data().capacity() { assert_eq!(history.total_index_to_index(i), None); - history.update([0.0].iter().copied()); + history.update(core::iter::once(0.0)); assert_eq!(history.total_index_to_index(i), Some(i)); } - history.update([0.0].iter().copied()); + history.update(core::iter::once(0.0)); // No longer existing. assert_eq!(history.total_index_to_index(0), None); assert_eq!(history.total_index_to_index(1), Some(0)); diff --git a/src/beat_detector.rs b/src/beat_detector.rs index bfee665..5279c7e 100644 --- a/src/beat_detector.rs +++ b/src/beat_detector.rs @@ -189,6 +189,8 @@ impl BeatDetector { } #[cfg(test)] +#[allow(clippy::excessive_precision)] +#[allow(clippy::missing_const_for_fn)] mod tests { use super::*; use crate::{test_utils, SampleInfo}; @@ -218,7 +220,7 @@ mod tests { let _ = detector.update_and_detect_beat(input); assert_eq!(detector.history.data().len(), 3); - let input = AudioInput::<_>::Iterator([0.3].iter().copied()); + let input = AudioInput::<_>::Iterator(core::iter::once(0.3)); let _ = detector.update_and_detect_beat(input); assert_eq!(detector.history.data().len(), 4); @@ -297,13 +299,12 @@ mod tests { ) -> Vec { samples .chunks(chunk_size) - .map(|samples| { + .flat_map(|samples| { let input = AudioInput::::SliceMono(samples); detector .update_and_detect_beat(input) .map(|info| info.max.total_index) }) - .filter_map(|info| info) .collect::>() }