From ec5e8d662688a29a68602ef6d164ae6464f83030 Mon Sep 17 00:00:00 2001 From: Alex Charlton Date: Mon, 27 Mar 2023 21:13:04 -0700 Subject: [PATCH] Clippy --- core/src/midi_file.rs | 2 -- core/src/song_to_midi.rs | 17 +++++++++-------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/core/src/midi_file.rs b/core/src/midi_file.rs index 59695d7..71eae33 100644 --- a/core/src/midi_file.rs +++ b/core/src/midi_file.rs @@ -54,7 +54,6 @@ pub fn push_vari(x: u32, v: &mut Vec) { #[derive(Debug, Copy, Clone)] #[repr(u16)] -#[allow(dead_code)] pub enum MidiFileFormat { SingleTrack = 0, SimultaniousTracks = 1, @@ -101,7 +100,6 @@ pub struct MidiFileTrack { /// Length of the track in ticks pub n_ticks: u32, } -#[allow(dead_code)] impl MidiFileTrack { pub fn extend_midi(&self, v: &mut Vec) { v.extend_from_slice(b"MTrk"); diff --git a/core/src/song_to_midi.rs b/core/src/song_to_midi.rs index 67fa393..0568e9a 100644 --- a/core/src/song_to_midi.rs +++ b/core/src/song_to_midi.rs @@ -14,7 +14,15 @@ pub struct Config { pub start_from: u8, } impl Config { - pub fn default() -> Self { + pub fn max_note_len(mut self, len_quarter: f32) -> Self { + let len = (len_quarter * TICKS_PER_QUARTER_NOTE as f32) as u32; + self.max_note_length = [len, len, len, len, len, len, len, len]; + self + } +} + +impl Default for Config { + fn default() -> Self { Self { global_transpose: 36, max_note_length: [ @@ -31,13 +39,6 @@ impl Config { start_from: 0, } } - - #[allow(dead_code)] - pub fn max_note_len(mut self, len_quarter: f32) -> Self { - let len = (len_quarter * TICKS_PER_QUARTER_NOTE as f32) as u32; - self.max_note_length = [len, len, len, len, len, len, len, len]; - self - } } #[derive(Debug)]