Skip to content

Commit 809f726

Browse files
committed
Fixed clippy and cargo fmt checks
1 parent 32cd51d commit 809f726

File tree

8 files changed

+12
-22
lines changed

8 files changed

+12
-22
lines changed

src/dsp/data.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ impl<T: DspData<P> + Send + 'static, P: Send + 'static> AsyncDspData<T, P> {
147147
data: None,
148148
rendered_rx,
149149
process_handle: Some(join_handle),
150-
phantom: PhantomData::default(),
150+
phantom: PhantomData,
151151
}
152152
}
153153
}

src/dsp/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,5 @@ mod waveform;
66

77
pub use data::{AsyncDspData, AsyncDspDataState, DspData, DspErr};
88
pub use spectrogram::{Spectrogram, SpectrogramParameters};
9-
pub use time_window::{
10-
SidePaddingType, WindowType, PADDING_HELP_TEXT,
11-
};
9+
pub use time_window::{SidePaddingType, WindowType, PADDING_HELP_TEXT};
1210
pub use waveform::{Waveform, WaveformParameters, WaveformPoint};

src/dsp/time_window.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ impl TimeWindowBatcher {
324324
// Compute the first sample to seek
325325
let new_seek_idx = self.crt_band_idx as u64 * self.tband_size as u64;
326326
self.sndfile
327-
.seek(SeekFrom::Start(new_seek_idx as u64))
327+
.seek(SeekFrom::Start(new_seek_idx))
328328
.unwrap_or_else(|_| panic!("Failed to seek frame {}", new_seek_idx));
329329

330330
// The offset left and right of the window lobe

src/render/headers.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ impl<'a> ChannelsTabs {
107107

108108
fn states(&'a self) -> Vec<(bool, &'a str)> {
109109
(0..self.count())
110-
.into_iter()
111110
.map(|idx| {
112111
let title = self.titles[idx].as_str();
113112
match self.activated.get(&idx) {
@@ -164,10 +163,7 @@ impl<'a> ChannelsTabs {
164163
.into_iter()
165164
.map(|v| v.to_string())
166165
.collect(), // 7.1
167-
_ => (0..count)
168-
.into_iter()
169-
.map(|idx| format!["Channel {:?}", idx])
170-
.collect(),
166+
_ => (0..count).map(|idx| format!["Channel {:?}", idx]).collect(),
171167
}
172168
}
173169
}

src/render/metadata.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ impl Renderer for MetadataRenderer {
209209
let value_style = Style::default();
210210

211211
// properties
212-
let properties = vec![
212+
let properties = [
213213
("Format", &self.metadata.format),
214214
("Format subtype", &self.metadata.subtype),
215215
("Endianess", &self.metadata.endianess),

src/render/renderer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ pub fn draw_text_info<B: Backend>(
6161
text: &str,
6262
) {
6363
let num_lines_to_center: usize = if area.height % 2 == 0 {
64-
usize::try_from(area.height).unwrap() / 2 - 1
64+
usize::from(area.height) / 2 - 1
6565
} else {
66-
usize::try_from(area.height).unwrap() / 2
66+
usize::from(area.height) / 2
6767
};
6868

6969
let mut span_vec = vec![Spans::from(""); num_lines_to_center];

src/render/waveform.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ impl WaveformRenderer {
107107

108108
WaveformRenderer {
109109
channels,
110-
async_renderer: AsyncDspData::new(path, WaveformParameters::default(), normalize),
110+
async_renderer: AsyncDspData::new(path, WaveformParameters, normalize),
111111
max_width_res: max_res,
112112
}
113113
}

src/render/widgets/image.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ impl<'a> Widget for Image<'a> {
3535

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

50-
buf.get_mut(
51-
x_char as u16 + img_area.left(),
52-
y_char as u16 + img_area.top(),
53-
)
54-
.set_char('▄')
55-
.set_bg(colors[0])
56-
.set_fg(colors[1]);
49+
buf.get_mut(x_char + img_area.left(), y_char + img_area.top())
50+
.set_char('▄')
51+
.set_bg(colors[0])
52+
.set_fg(colors[1]);
5753
});
5854
}
5955
}

0 commit comments

Comments
 (0)