From 517533414497199adbe841f37cdf9c07a13d9c02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janosch=20Gr=C3=A4f?= Date: Thu, 15 Jan 2026 14:44:23 +0100 Subject: [PATCH] fix compiler warning when compiling without default features --- src/decoder/builder.rs | 5 ++++- src/decoder/mod.rs | 18 +++++++++++++++--- src/source/mod.rs | 4 ++-- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/decoder/builder.rs b/src/decoder/builder.rs index 8d6dc247..3d89ee9d 100644 --- a/src/decoder/builder.rs +++ b/src/decoder/builder.rs @@ -302,7 +302,10 @@ impl DecoderBuilder { } #[cfg(not(feature = "symphonia"))] - Err(DecoderError::UnrecognizedFormat) + { + let _ = data; + Err(DecoderError::UnrecognizedFormat) + } } /// Creates a new decoder with previously configured settings. diff --git a/src/decoder/mod.rs b/src/decoder/mod.rs index c68fbb2d..507858ef 100644 --- a/src/decoder/mod.rs +++ b/src/decoder/mod.rs @@ -101,6 +101,7 @@ pub struct Decoder(DecoderImpl); pub struct LoopedDecoder { /// The underlying decoder implementation. inner: Option>, + /// Configuration settings for the decoder. settings: Settings, } @@ -249,7 +250,10 @@ impl DecoderImpl { DecoderImpl::Mp3(source) => source.try_seek(pos), #[cfg(feature = "symphonia")] DecoderImpl::Symphonia(source, PhantomData) => source.try_seek(pos), - DecoderImpl::None(_, _) => unreachable!(), + DecoderImpl::None(_, _) => { + let _ = pos; + unreachable!() + } } } } @@ -622,6 +626,7 @@ where // Take ownership of the decoder to reset it let decoder = self.inner.take()?; + let (new_decoder, sample) = match decoder { #[cfg(all(feature = "hound", not(feature = "symphonia-wav")))] DecoderImpl::Wav(source) => { @@ -667,9 +672,16 @@ where let sample = source.next(); (DecoderImpl::Symphonia(source, PhantomData), sample) } + DecoderImpl::None(unreachable, phantom) => { + let _ = self.settings; + (DecoderImpl::None(unreachable, phantom), None) + } }; - self.inner = Some(new_decoder); - sample + + { + self.inner = Some(new_decoder); + sample + } } else { None } diff --git a/src/source/mod.rs b/src/source/mod.rs index b458d13a..938e2984 100644 --- a/src/source/mod.rs +++ b/src/source/mod.rs @@ -6,7 +6,7 @@ use std::sync::Arc; use crate::{ buffer::SamplesBuffer, common::{assert_error_traits, ChannelCount, SampleRate}, - math, BitDepth, Float, Sample, + math, Float, Sample, }; use dasp_sample::FromSample; @@ -231,7 +231,7 @@ pub trait Source: Iterator { #[cfg(feature = "dither")] #[cfg_attr(docsrs, doc(cfg(feature = "dither")))] #[inline] - fn dither(self, target_bits: BitDepth, algorithm: DitherAlgorithm) -> Dither + fn dither(self, target_bits: crate::BitDepth, algorithm: DitherAlgorithm) -> Dither where Self: Sized, {