From f339184d75f307d560c3a3a92a4ddec47df0c594 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Sun, 27 Sep 2015 10:24:41 +0200 Subject: [PATCH] Fix all warnings --- src/conversions/amplifier.rs | 38 --------------------------------- src/conversions/mod.rs | 2 -- src/conversions/samples_rate.rs | 5 ++--- src/decoder/mod.rs | 2 -- src/decoder/vorbis.rs | 3 +-- src/decoder/wav.rs | 3 +-- src/engine.rs | 1 - src/lib.rs | 2 +- 8 files changed, 5 insertions(+), 51 deletions(-) delete mode 100644 src/conversions/amplifier.rs diff --git a/src/conversions/amplifier.rs b/src/conversions/amplifier.rs deleted file mode 100644 index a2ed884..0000000 --- a/src/conversions/amplifier.rs +++ /dev/null @@ -1,38 +0,0 @@ -use conversions::Sample; - -pub struct AmplifierIterator where I: Iterator { - input: I, - amplication: f32, -} - -impl AmplifierIterator where I: Iterator { - #[inline] - pub fn new(input: I, amplication: f32) -> AmplifierIterator { - AmplifierIterator { - input: input, - amplication: amplication, - } - } - - #[inline] - pub fn set_amplification(&mut self, new_value: f32) { - self.amplication = new_value; - } -} - -impl Iterator for AmplifierIterator where I: Iterator, I::Item: Sample { - type Item = I::Item; - - #[inline] - fn next(&mut self) -> Option { - self.input.next().map(|value| value.amplify(self.amplication)) - } - - #[inline] - fn size_hint(&self) -> (usize, Option) { - self.input.size_hint() - } -} - -impl ExactSizeIterator for AmplifierIterator - where I: ExactSizeIterator, I::Item: Sample {} diff --git a/src/conversions/mod.rs b/src/conversions/mod.rs index d6a71ce..b999cec 100644 --- a/src/conversions/mod.rs +++ b/src/conversions/mod.rs @@ -8,9 +8,7 @@ pub use self::sample::Sample; pub use self::sample::DataConverter; pub use self::channels::ChannelsCountConverter; pub use self::samples_rate::SamplesRateConverter; -pub use self::amplifier::AmplifierIterator; -mod amplifier; mod channels; mod sample; mod samples_rate; diff --git a/src/conversions/samples_rate.rs b/src/conversions/samples_rate.rs index 93b0973..d23d96a 100644 --- a/src/conversions/samples_rate.rs +++ b/src/conversions/samples_rate.rs @@ -1,7 +1,6 @@ use cpal; use conversions::Sample; -use std::iter; use std::mem; /// Iterator that converts from a certain samples rate to another. @@ -61,8 +60,8 @@ impl SamplesRateConverter where I: Iterator, I::Item: Sample { debug_assert_eq!(from, gcd); (Vec::new(), Vec::new()) } else { - let mut first = input.by_ref().take(num_channels as usize).collect::>(); - let mut next = input.by_ref().take(num_channels as usize).collect::>(); + let first = input.by_ref().take(num_channels as usize).collect::>(); + let next = input.by_ref().take(num_channels as usize).collect::>(); (first, next) }; diff --git a/src/decoder/mod.rs b/src/decoder/mod.rs index 5a4a28e..2515493 100644 --- a/src/decoder/mod.rs +++ b/src/decoder/mod.rs @@ -2,8 +2,6 @@ use std::io::{Read, Seek}; use std::sync::Arc; use std::sync::Mutex; -use cpal::Endpoint; - mod vorbis; mod wav; diff --git a/src/decoder/vorbis.rs b/src/decoder/vorbis.rs index 0cc1e07..126f0e4 100644 --- a/src/decoder/vorbis.rs +++ b/src/decoder/vorbis.rs @@ -1,9 +1,8 @@ use std::io::{Read, Seek}; -use std::f64::INFINITY; use super::Decoder; use conversions; -use cpal::{self, Endpoint, Voice}; +use cpal; use vorbis; pub struct VorbisDecoder { diff --git a/src/decoder/wav.rs b/src/decoder/wav.rs index 4e35630..eb583d9 100644 --- a/src/decoder/wav.rs +++ b/src/decoder/wav.rs @@ -1,9 +1,8 @@ use std::io::{Read, Seek, SeekFrom}; -use std::cmp; use super::Decoder; use conversions; -use cpal::{self, Endpoint, Voice}; +use cpal; use hound::WavReader; pub struct WavDecoder { diff --git a/src/engine.rs b/src/engine.rs index 1267316..1efabef 100644 --- a/src/engine.rs +++ b/src/engine.rs @@ -1,4 +1,3 @@ -use std::cmp; use std::mem; use std::collections::HashMap; use std::io::{Read, Seek}; diff --git a/src/lib.rs b/src/lib.rs index da3e9c3..62b01b9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,5 @@ #![cfg_attr(test, deny(missing_docs))] -//#![cfg_attr(test, deny(warnings))] +#![cfg_attr(test, deny(warnings))] extern crate cpal; extern crate hound;