Skip to content

Commit

Permalink
fix: cargo clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
B0ney committed Jan 10, 2024
1 parent e92f319 commit 86dceac
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 29 deletions.
29 changes: 13 additions & 16 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -407,14 +407,11 @@ impl multi_window::Application for XMODITS {
);
}
Message::SaveErrorsResult(result) => {
match result {
Ok(path) => {
tracing::info!("Successfully saved errors to: {}", &path.display());
if self.general_cfg.show_errors_in_text_editor {
let _ = open::that_detached(path);
}
if let Ok(path) = result {
tracing::info!("Successfully saved errors to: {}", &path.display());
if self.general_cfg.show_errors_in_text_editor {
let _ = open::that_detached(path);
}
_ => (), // todo
}
}
Message::StartRipping => {
Expand All @@ -440,19 +437,18 @@ impl multi_window::Application for XMODITS {
true => self.file_hovered = true,
false => self.sample_player.set_hovered(id, true),
},
event::Event::FileDropped(id, file) => match id == window::Id::MAIN {
true => {
event::Event::FileDropped(id, file) => {
if id == window::Id::MAIN {
self.add_entry(file);
self.file_hovered = false;
}
false => {
} else {
self.sample_player.set_hovered(id, false);
return self
.sample_player
.load_samples(id, file)
.map(Message::SamplePlayer);
}
},
}
event::Event::Save => return self.save_cfg(),
event::Event::Start => return self.start_ripping(),
},
Expand Down Expand Up @@ -485,11 +481,12 @@ impl multi_window::Application for XMODITS {
Command::none()
}

fn view(&self, id: window::Id) -> Element<Message> {
if id > window::Id::MAIN {
fn view(&self, _id: window::Id) -> Element<Message> {
#[cfg(feature = "audio")]
if _id > window::Id::MAIN {
return self
.sample_player
.view(id, &self.entries)
.view(_id, &self.entries)
.map(Message::SamplePlayer);
}

Expand Down Expand Up @@ -605,7 +602,7 @@ impl multi_window::Application for XMODITS {
state,
time,
destination,
} => main_panel::view_finished(state, time, self.file_hovered, &destination),
} => main_panel::view_finished(state, time, self.file_hovered, destination),
};

let allow_warnings = !self.general_cfg.suppress_warnings;
Expand Down
2 changes: 1 addition & 1 deletion src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub fn parse(args: Vec<String>) -> Mode {
}

#[cfg(windows)]
if args.len() > 0 {
if !args.is_empty() {
return Mode::DragNDrop(args);
}

Expand Down
3 changes: 0 additions & 3 deletions src/screen/sample_player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ pub mod preview_manager_dummy {
pub fn update(&mut self, _msg: Message, _entries: &mut Entries) -> Command<Message> {
Command::none()
}
pub fn view(&self, _id: Id, _entries: &Entries) -> Element<Message> {
unimplemented!("Attempt to view sample player without 'audio' feature")
}
pub fn load_samples(&self, _id: Id, _path: PathBuf) -> Command<Message> {
Command::none()
}
Expand Down
2 changes: 1 addition & 1 deletion src/screen/sample_player/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ impl Instance {
let load = |state: &mut State, path: PathBuf| {
*state = State::Loading;
self.player.stop();
return load_samples(path);
load_samples(path)
};

match &self.state {
Expand Down
2 changes: 1 addition & 1 deletion src/screen/sample_player/instance/sample.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::icon;
use crate::theme;
use crate::widget::helpers::centered_container;
use crate::widget::waveform_view::WaveData;
use crate::widget::{Button, Collection, Container, Element, Row};
use crate::widget::{Collection, Element};

use audio_engine;

Expand Down
7 changes: 0 additions & 7 deletions src/widget/waveform_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,13 +230,6 @@ impl State {
fn reset_zoom(&mut self) {
self.zoom = 1.0;
}

fn bounds_check_offset(&mut self, wave: &WaveData) {
let wave_len = (wave.peaks()[0].len() as f32 * self.zoom) as usize;
if self.wave_offset > wave_len {
self.wave_offset = wave_len.saturating_sub(1);
}
}

fn update_zoom(&mut self, wave: &WaveData) {
self.zoom = self.zoom.clamp(MIN_SCALE, MAX_SCALE);
Expand Down

0 comments on commit 86dceac

Please sign in to comment.