From 5a0b1bbbcd86eb256ea6c1401ae6f366959c731a Mon Sep 17 00:00:00 2001 From: Andreas Pehrson Date: Thu, 11 Apr 2024 21:56:18 +0200 Subject: [PATCH] fix warning for unused output_channel and format --- src/coefficient.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/coefficient.rs b/src/coefficient.rs index ed5577c..299483a 100644 --- a/src/coefficient.rs +++ b/src/coefficient.rs @@ -94,13 +94,13 @@ where || *channel == Channel::FrontLeft || *channel == Channel::FrontRight; } - let coefficient_matrix = if only_stereo_or_discrete && output_channels.len() >2 && input_channels.len() <= output_channels.len() { + let coefficient_matrix = if only_stereo_or_discrete + && output_channels.len() > 2 + && input_channels.len() <= output_channels.len() + { let mut matrix = Vec::with_capacity(output_channels.len()); - let mut idx = 0; // Create a diagonal line of 1.0 for input channels - for output_channel in output_channels { - let output_channel_index = idx; - idx+=1; + for (output_channel_index, _) in output_channels.iter().enumerate() { let mut coefficients = Vec::with_capacity(input_channels.len()); coefficients.resize(input_channels.len(), 0.0); if output_channel_index < coefficients.len() { @@ -108,20 +108,20 @@ where } matrix.push(coefficients); } - matrix + matrix } else { - let mixing_matrix = Self::build_mixing_matrix(input_layout.channel_map, output_layout.channel_map) - .unwrap_or_else(|_| Self::get_basic_matrix()); + let mixing_matrix = + Self::build_mixing_matrix(input_layout.channel_map, output_layout.channel_map) + .unwrap_or_else(|_| Self::get_basic_matrix()); Self::pick_coefficients( &input_layout.channels, &output_layout.channels, &mixing_matrix, ) }; - + println!("coeffs {:?}", coefficient_matrix); - for row in coefficient_matrix.iter() { println!("{:?}", row); }