Skip to content

Commit 00a2606

Browse files
authored
Merge pull request #358 from orottier/clippy-fixes-1.72
Clippy fixes rust version 1.72
2 parents 471a9ce + 504197a commit 00a2606

File tree

4 files changed

+15
-7
lines changed

4 files changed

+15
-7
lines changed

src/analysis.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ mod tests {
781781
analyser.set_fft_size(RENDER_QUANTUM_SIZE);
782782

783783
// get data, should be zero (negative infinity decibel)
784-
let mut bins = vec![255; RENDER_QUANTUM_SIZE];
784+
let mut bins = [255; RENDER_QUANTUM_SIZE];
785785
analyser.get_byte_frequency_data(&mut bins[..], 0.);
786786

787787
// only N / 2 values should contain frequency data, rest is unaltered

src/io/cpal.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ use crate::{AtomicF64, MAX_CHANNELS};
2020

2121
use crossbeam_channel::Receiver;
2222

23+
// I doubt this construct is entirely safe. Stream is not Send/Sync (probably for a good reason) so
24+
// it should be managed from a single thread instead.
25+
// <https://github.com/orottier/web-audio-api-rs/issues/357>
2326
mod private {
2427
use super::*;
2528

@@ -28,6 +31,7 @@ mod private {
2831

2932
impl ThreadSafeClosableStream {
3033
pub fn new(stream: Stream) -> Self {
34+
#[allow(clippy::arc_with_non_send_sync)]
3135
Self(Arc::new(Mutex::new(Some(stream))))
3236
}
3337

src/io/cubeb.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ impl<F> CubebStream for Stream<F> {
3434
}
3535
}
3636

37+
// I doubt this construct is entirely safe. Stream is not Send/Sync (probably for a good reason) so
38+
// it should be managed from a single thread instead.
39+
// <https://github.com/orottier/web-audio-api-rs/issues/357>
3740
mod private {
3841
use super::*;
3942
use std::sync::Mutex;
@@ -44,6 +47,7 @@ mod private {
4447
impl ThreadSafeClosableStream {
4548
pub fn new<F: 'static>(stream: Stream<F>) -> Self {
4649
let boxed_stream = BoxedStream(Box::new(stream));
50+
#[allow(clippy::arc_with_non_send_sync)]
4751
Self(Arc::new(Mutex::new(Some(boxed_stream))))
4852
}
4953

src/node/convolver.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ mod tests {
473473
let ir = vec![1.];
474474
let calibration = 0.00125;
475475
let channel_data = vec![0., 1., 0., -1., 0.];
476-
let expected = vec![0., calibration, 0., -calibration, 0., 0., 0., 0., 0., 0.];
476+
let expected = [0., calibration, 0., -calibration, 0., 0., 0., 0., 0., 0.];
477477

478478
// identity ir
479479
let ir = AudioBuffer::from(vec![ir; 1], sample_rate);
@@ -518,23 +518,23 @@ mod tests {
518518
#[test]
519519
fn test_passthrough() {
520520
let output = test_convolve(&[0., 1., 0., -1., 0.], None, 10);
521-
let expected = vec![0., 1., 0., -1., 0., 0., 0., 0., 0., 0.];
521+
let expected = [0., 1., 0., -1., 0., 0., 0., 0., 0., 0.];
522522
assert_float_eq!(output.get_channel_data(0), &expected[..], abs_all <= 1E-6);
523523
}
524524

525525
#[test]
526526
fn test_empty() {
527527
let ir = vec![];
528528
let output = test_convolve(&[0., 1., 0., -1., 0.], Some(ir), 10);
529-
let expected = vec![0.; 10];
529+
let expected = [0.; 10];
530530
assert_float_eq!(output.get_channel_data(0), &expected[..], abs_all <= 1E-6);
531531
}
532532

533533
#[test]
534534
fn test_zeroed() {
535535
let ir = vec![0., 0., 0., 0., 0., 0.];
536536
let output = test_convolve(&[0., 1., 0., -1., 0.], Some(ir), 10);
537-
let expected = vec![0.; 10];
537+
let expected = [0.; 10];
538538
assert_float_eq!(output.get_channel_data(0), &expected[..], abs_all <= 1E-6);
539539
}
540540

@@ -543,7 +543,7 @@ mod tests {
543543
let ir = vec![1.];
544544
let calibration = 0.00125;
545545
let output = test_convolve(&[0., 1., 0., -1., 0.], Some(ir), 10);
546-
let expected = vec![0., calibration, 0., -calibration, 0., 0., 0., 0., 0., 0.];
546+
let expected = [0., calibration, 0., -calibration, 0., 0., 0., 0., 0., 0.];
547547
assert_float_eq!(output.get_channel_data(0), &expected[..], abs_all <= 1E-6);
548548
}
549549

@@ -552,7 +552,7 @@ mod tests {
552552
let ir = vec![1., 1.];
553553
let calibration = 0.00125;
554554
let output = test_convolve(&[0., 1., 0., -1., 0.], Some(ir), 10);
555-
let expected = vec![
555+
let expected = [
556556
0.,
557557
calibration,
558558
calibration,

0 commit comments

Comments
 (0)