From 2dd55b9ea6f9e405775f576f85a833a1edcabd77 Mon Sep 17 00:00:00 2001 From: zyc <18611145971@163.com> Date: Thu, 27 Feb 2025 15:22:56 +0800 Subject: [PATCH 1/3] Modify_inconsistency --- src/buffer.rs | 4 ++-- src/lib.rs | 2 +- src/node/panner.rs | 4 ++-- src/render/quantum.rs | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/buffer.rs b/src/buffer.rs index 60561b1d..b9b76736 100644 --- a/src/buffer.rs +++ b/src/buffer.rs @@ -258,7 +258,7 @@ impl AudioBuffer { /// Get the samples from this specific channel. /// - /// Panics if the index is greater than the available number of channels + /// Panics if the index >= self.channels.len() // @note - this one is used in pub(crate) fn channel_data(&self, index: usize) -> &ChannelData { &self.channels[index] @@ -266,7 +266,7 @@ impl AudioBuffer { /// Get the samples (mutable) from this specific channel. /// - /// Panics if the index is greater than the available number of channels + /// Panics if the index >= self.channels.len() pub(crate) fn channel_data_mut(&mut self, index: usize) -> &mut ChannelData { &mut self.channels[index] } diff --git a/src/lib.rs b/src/lib.rs index a7c97151..dbf935bf 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -195,7 +195,7 @@ pub(crate) fn assert_valid_channel_number(channel_number: usize, number_of_chann /// # Panics /// /// This function will panic if: -/// - the given value is not lower than or equal to zero +/// - the given length is less than or equal to zero /// #[track_caller] #[inline(always)] diff --git a/src/node/panner.rs b/src/node/panner.rs index 3cc7f0f5..7a19727f 100644 --- a/src/node/panner.rs +++ b/src/node/panner.rs @@ -20,7 +20,7 @@ use super::{AudioNode, AudioNodeOptions, ChannelConfig, ChannelCountMode, Channe /// # Panics /// /// This function will panic if: -/// - the given value is not finite and lower than zero +/// - the given value is greater than one and lower than zero #[track_caller] #[inline(always)] #[allow(clippy::manual_range_contains)] @@ -572,7 +572,7 @@ impl PannerNode { /// /// # Panics /// - /// Panics if the provided value is negative. + /// Panics if the provided value is not positive. pub fn set_max_distance(&mut self, value: f64) { assert!( value > 0., diff --git a/src/render/quantum.rs b/src/render/quantum.rs index fdc0e6eb..e5f6995f 100644 --- a/src/render/quantum.rs +++ b/src/render/quantum.rs @@ -228,7 +228,7 @@ impl AudioRenderQuantum { /// Get the samples from this specific channel. /// /// # Panics - /// Panics if the index is greater than the available number of channels + /// Panics if index >= self.channels.len() pub fn channel_data(&self, index: usize) -> &AudioRenderQuantumChannel { &self.channels[index] } @@ -236,7 +236,7 @@ impl AudioRenderQuantum { /// Get the samples (mutable) from this specific channel. /// /// # Panics - /// Panics if the index is greater than the available number of channels + /// Panics if index >= self.channels.len() pub fn channel_data_mut(&mut self, index: usize) -> &mut AudioRenderQuantumChannel { &mut self.channels[index] } From ec0518762e5b378fdb2ab3e857a5598b6e019123 Mon Sep 17 00:00:00 2001 From: zyc <18611145971@163.com> Date: Mon, 23 Jun 2025 22:06:16 +0800 Subject: [PATCH 2/3] Fix --- src/node/panner.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node/panner.rs b/src/node/panner.rs index 7a19727f..15a551b2 100644 --- a/src/node/panner.rs +++ b/src/node/panner.rs @@ -20,7 +20,7 @@ use super::{AudioNode, AudioNodeOptions, ChannelConfig, ChannelCountMode, Channe /// # Panics /// /// This function will panic if: -/// - the given value is greater than one and lower than zero +/// - value < 0 or value > 1 #[track_caller] #[inline(always)] #[allow(clippy::manual_range_contains)] From 7a87195f0e136e025e9d7ce5fd8d8aeb30ca7977 Mon Sep 17 00:00:00 2001 From: zyc <18611145971@163.com> Date: Sat, 28 Jun 2025 22:24:50 +0800 Subject: [PATCH 3/3] Fix --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index dbf935bf..07f5fd13 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -213,7 +213,7 @@ pub(crate) fn assert_valid_buffer_length(length: usize) { /// # Panics /// /// This function will panic if: -/// - the given value is not finite and lower than zero +/// - the given value is not finite or lower than zero /// #[track_caller] #[inline(always)]