Skip to content

Commit bf026fa

Browse files
authored
Merge pull request #7 from miek/clippy
Clippy fixes
2 parents 9343e25 + 9804625 commit bf026fa

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/csv.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ pub struct Record {
2323
pub freq_low: u64,
2424
pub freq_high: u64,
2525
pub freq_step: f32,
26+
#[allow(dead_code)]
2627
pub num_samples: u32,
2728
pub samples: Vec<f32>,
2829
}
@@ -56,7 +57,7 @@ pub fn load_records(input_path: &str) -> Result<RecordCollection, Box<dyn Error>
5657
.trim(csv::Trim::All)
5758
.from_reader(input);
5859

59-
let mut rc = RecordCollection{ freq_low: std::u64::MAX, ..Default::default() };
60+
let mut rc = RecordCollection{ freq_low: u64::MAX, ..Default::default() };
6061

6162
// Loop through all lines & parse records
6263
// also keep track of frequency range & unique timestamps to determine final image size
@@ -72,7 +73,7 @@ pub fn load_records(input_path: &str) -> Result<RecordCollection, Box<dyn Error>
7273
rc.freq_low = std::cmp::min(rc.freq_low, record.freq_low);
7374
rc.freq_high = std::cmp::max(rc.freq_high, record.freq_high);
7475
if let Some(s) = step {
75-
if (s - record.freq_step).abs() > std::f32::EPSILON {
76+
if (s - record.freq_step).abs() > f32::EPSILON {
7677
return Err("Frequency step must be constant".into());
7778
}
7879
} else {

src/draw.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ pub fn colormaps() -> HashMap<&'static str, Gradient> {
2626
}
2727

2828
fn build_lut(colormap: &Gradient) -> Vec<plotters::style::RGBColor> {
29-
let mut lut = Vec::with_capacity(std::u16::MAX as usize + 1);
30-
for i in 0..std::u16::MAX as usize + 1 {
31-
let value = colormap.eval_continuous(i as f64 / std::u16::MAX as f64);
29+
let mut lut = Vec::with_capacity(u16::MAX as usize + 1);
30+
for i in 0..u16::MAX as usize + 1 {
31+
let value = colormap.eval_continuous(i as f64 / u16::MAX as f64);
3232
lut.push(plotters::style::RGBColor(value.r, value.g, value.b));
3333
}
3434
lut

0 commit comments

Comments
 (0)