Skip to content

Commit

Permalink
Fixed clippy and cargo fmt checks
Browse files Browse the repository at this point in the history
  • Loading branch information
maxmarsc committed Feb 24, 2024
1 parent 32cd51d commit 809f726
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/dsp/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ impl<T: DspData<P> + Send + 'static, P: Send + 'static> AsyncDspData<T, P> {
data: None,
rendered_rx,
process_handle: Some(join_handle),
phantom: PhantomData::default(),
phantom: PhantomData,
}
}
}
4 changes: 1 addition & 3 deletions src/dsp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,5 @@ mod waveform;

pub use data::{AsyncDspData, AsyncDspDataState, DspData, DspErr};
pub use spectrogram::{Spectrogram, SpectrogramParameters};
pub use time_window::{
SidePaddingType, WindowType, PADDING_HELP_TEXT,
};
pub use time_window::{SidePaddingType, WindowType, PADDING_HELP_TEXT};
pub use waveform::{Waveform, WaveformParameters, WaveformPoint};
2 changes: 1 addition & 1 deletion src/dsp/time_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ impl TimeWindowBatcher {
// Compute the first sample to seek
let new_seek_idx = self.crt_band_idx as u64 * self.tband_size as u64;
self.sndfile
.seek(SeekFrom::Start(new_seek_idx as u64))
.seek(SeekFrom::Start(new_seek_idx))
.unwrap_or_else(|_| panic!("Failed to seek frame {}", new_seek_idx));

// The offset left and right of the window lobe
Expand Down
6 changes: 1 addition & 5 deletions src/render/headers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ impl<'a> ChannelsTabs {

fn states(&'a self) -> Vec<(bool, &'a str)> {
(0..self.count())
.into_iter()
.map(|idx| {
let title = self.titles[idx].as_str();
match self.activated.get(&idx) {
Expand Down Expand Up @@ -164,10 +163,7 @@ impl<'a> ChannelsTabs {
.into_iter()
.map(|v| v.to_string())
.collect(), // 7.1
_ => (0..count)
.into_iter()
.map(|idx| format!["Channel {:?}", idx])
.collect(),
_ => (0..count).map(|idx| format!["Channel {:?}", idx]).collect(),
}
}
}
2 changes: 1 addition & 1 deletion src/render/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ impl Renderer for MetadataRenderer {
let value_style = Style::default();

// properties
let properties = vec![
let properties = [
("Format", &self.metadata.format),
("Format subtype", &self.metadata.subtype),
("Endianess", &self.metadata.endianess),
Expand Down
4 changes: 2 additions & 2 deletions src/render/renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ pub fn draw_text_info<B: Backend>(
text: &str,
) {
let num_lines_to_center: usize = if area.height % 2 == 0 {
usize::try_from(area.height).unwrap() / 2 - 1
usize::from(area.height) / 2 - 1
} else {
usize::try_from(area.height).unwrap() / 2
usize::from(area.height) / 2
};

let mut span_vec = vec![Spans::from(""); num_lines_to_center];
Expand Down
2 changes: 1 addition & 1 deletion src/render/waveform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ impl WaveformRenderer {

WaveformRenderer {
channels,
async_renderer: AsyncDspData::new(path, WaveformParameters::default(), normalize),
async_renderer: AsyncDspData::new(path, WaveformParameters, normalize),
max_width_res: max_res,
}
}
Expand Down
12 changes: 4 additions & 8 deletions src/render/widgets/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ impl<'a> Widget for Image<'a> {

self.img_buffer
.chunks(6)
.into_iter()
.map(|pixels| {
[
Color::Rgb(pixels[0], pixels[1], pixels[2]),
Expand All @@ -47,13 +46,10 @@ impl<'a> Widget for Image<'a> {
let x_char = idx as u16 / img_area.height;
let y_char = img_area.height - (idx as u16 % img_area.height) - 1;

buf.get_mut(
x_char as u16 + img_area.left(),
y_char as u16 + img_area.top(),
)
.set_char('▄')
.set_bg(colors[0])
.set_fg(colors[1]);
buf.get_mut(x_char + img_area.left(), y_char + img_area.top())
.set_char('▄')
.set_bg(colors[0])
.set_fg(colors[1]);
});
}
}

0 comments on commit 809f726

Please sign in to comment.