summaryrefslogtreecommitdiff
path: root/src/decoder.rs
diff options
context:
space:
mode:
authorYuval Adam <_@yuv.al>2025-06-24 11:06:59 +0200
committerYuval Adam <_@yuv.al>2025-06-24 11:06:59 +0200
commit0357929946dbaa437637d75310a6e819481a5925 (patch)
tree918429cf942e0d1a49e026d528c73adc8aa00b54 /src/decoder.rs
parentb9e321ff444970998a43cbf581648b3a15111804 (diff)
Add CI and some clippy cleanup
Diffstat (limited to 'src/decoder.rs')
-rw-r--r--src/decoder.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/decoder.rs b/src/decoder.rs
index 80458a0..1a217d3 100644
--- a/src/decoder.rs
+++ b/src/decoder.rs
@@ -1,8 +1,8 @@
-use anyhow::{bail, Result};
+use anyhow::{Result, bail};
use rubato::{
Resampler, SincFixedIn, SincInterpolationParameters, SincInterpolationType, WindowFunction,
};
-use rustfft::{num_complex::Complex, FftPlanner};
+use rustfft::{FftPlanner, num_complex::Complex};
use std::collections::VecDeque;
use std::io::Write;
// --- DSP Constants ---
@@ -552,8 +552,8 @@ fn trace_signal(signal: &[f32], threshold: f32, wpm: f32) -> std::io::Result<()>
let bar_len = (val / max_val * 100.0).round() as usize;
let thresh_pos = (threshold / max_val * 100.0).round() as usize;
let mut line = vec![' '; 101];
- for i in 0..bar_len.min(100) {
- line[i] = '#';
+ for item in line.iter_mut().take(bar_len.min(100)) {
+ *item = '#';
}
if thresh_pos <= 100 {
line[thresh_pos] = '|';