Skip to content

Commit 29fc1ed

Browse files
committed
muxml1, parser: formatting
1 parent 58ce8da commit 29fc1ed

File tree

2 files changed

+10
-17
lines changed

2 files changed

+10
-17
lines changed

src/backend/muxml2/mod.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -228,20 +228,15 @@ fn gen_muxml2<'a>(
228228
};
229229
use TabElement::*;
230230
match raw_tick.element {
231-
Fret(..) | DeadNote => {
232-
// TODO: not sure if cloning would be faster here
233-
//notes_in_tick.push((string_idx as u8, measure.content.start() + tick));
234-
notes_in_tick += 1;
235-
}
231+
Fret(..) | DeadNote => notes_in_tick += 1,
236232
FretBend(..) | FretBendTo(..) => {
237-
//notes_in_tick.push((string_idx as u8, measure.content.start() + tick));
238233
notes_in_tick += 1;
239234
if settings.bend_mode == Muxml2BendMode::EmulateBends {
240235
// fix content len for stuff where we generate 2 notes for a bend
241236
measure_content_len += 1;
242237
}
243238
}
244-
_ => (),
239+
Rest => (),
245240
}
246241
}
247242
// if there were no notes inserted in this tick, add a rest

src/parser/mod.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -185,16 +185,13 @@ pub fn dump_tracks(tracks: &[Vec<RawTick>; 6], bend_targets: &BendTargets) -> St
185185
.map(|(pos, x)| x.element.repr_len(bend_targets, &pos))
186186
.max()
187187
.unwrap() as usize;
188-
match tracks[track][i].element {
189-
TabElement::Fret(x) => bufs[track].push_str(&format!("{x:<0$}", tick_len)),
190-
TabElement::Rest => {
191-
bufs[track].push_str(&format!("{1:<0$}", tick_len, "-"));
192-
}
193-
TabElement::DeadNote => {
194-
bufs[track].push_str(&format!("{1:<0$}", tick_len, "x"));
195-
}
196-
TabElement::FretBend(x) => bufs[track].push_str(&format!("{x:<0$}b", tick_len - 1)),
197-
TabElement::FretBendTo(x) => {
188+
use TabElement::*;
189+
match &tracks[track][i].element {
190+
Fret(x) => bufs[track].push_str(&format!("{x:<0$}", tick_len)),
191+
Rest => bufs[track].push_str(&format!("{1:<0$}", tick_len, "-")),
192+
DeadNote => bufs[track].push_str(&format!("{1:<0$}", tick_len, "x")),
193+
FretBend(x) => bufs[track].push_str(&format!("{x:<0$}b", tick_len - 1)),
194+
FretBendTo(x) => {
198195
let y = bend_targets
199196
.get(&(track as u8, i as u32))
200197
.expect("Unreachable: FretBendTo without target");
@@ -214,6 +211,7 @@ fn string_name() -> impl Fn(&str) -> Result<(&str, char), &str> {
214211
_ => Err(s),
215212
}
216213
}
214+
217215
#[derive(Debug, PartialEq, Clone)]
218216
pub enum TabElement {
219217
Fret(u8),

0 commit comments

Comments
 (0)