summaryrefslogtreecommitdiff
path: root/src
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
parentb9e321ff444970998a43cbf581648b3a15111804 (diff)
Add CI and some clippy cleanup
Diffstat (limited to 'src')
-rw-r--r--src/decoder.rs8
-rw-r--r--src/generator.rs2
-rw-r--r--src/main.rs2
3 files changed, 6 insertions, 6 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] = '|';
diff --git a/src/generator.rs b/src/generator.rs
index 7a21f07..13fa814 100644
--- a/src/generator.rs
+++ b/src/generator.rs
@@ -187,7 +187,7 @@ mod tests {
let generator = MorseGenerator::new(12000, 600.0, 20.0);
let result = generator.generate_wav_file("SOS", "test_sos.wav");
assert!(result.is_ok());
-
+
// Clean up test file
std::fs::remove_file("test_sos.wav").ok();
}
diff --git a/src/main.rs b/src/main.rs
index 72869af..fdc0012 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,4 +1,4 @@
-use anyhow::{bail, Result};
+use anyhow::{Result, bail};
use clap::Parser;
use hound::{SampleFormat, WavReader};
use std::path::PathBuf;