Skip to content

Commit

Permalink
Remove fn main from wasm target
Browse files Browse the repository at this point in the history
  • Loading branch information
barafael committed Jun 3, 2023
1 parent 614e486 commit 9f88548
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 19 deletions.
2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ ml_gpu = ["ml_train", "burn-tch"]

wasm = ["rodio/wasm-bindgen", "wasm-bindgen", "wasm-bindgen-futures", "js-sys", "console_error_panic_hook", "wee_alloc", "gloo-timers"]

wasm_no_main = []

plot = ["plotters"]

[dependencies]
Expand Down
4 changes: 2 additions & 2 deletions src/core/note.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ impl Add<Interval> for Note {
// Basically, if we were already "on" the weird one (this is a perfect unision, or perfect octave, etc.), then we don't
// do anything special. Otherwise, if we landed on on of these edge cases, then we need to adjust the octave.
let mut special_octave = 0;

if self.named_pitch != new_pitch {
if new_pitch == NamedPitch::CFlat
|| new_pitch == NamedPitch::CDoubleFlat
Expand Down Expand Up @@ -459,7 +459,7 @@ impl Sub<Interval> for Note {
// Basically, if we were already "on" the weird one (this is a perfect unision, or perfect octave, etc.), then we don't
// do anything special. Otherwise, if we landed on on of these edge cases, then we need to adjust the octave.
let mut special_octave = 0;

if self.named_pitch != new_pitch {
if new_pitch == NamedPitch::CFlat
|| new_pitch == NamedPitch::CDoubleFlat
Expand Down
15 changes: 0 additions & 15 deletions src/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,6 @@ static ALLOC: wee_alloc::WeeAlloc<'_> = wee_alloc::WeeAlloc::INIT;
/// The [`Result`] type for the WASM bindings.
pub type JsRes<T> = Result<T, JsValue>;

// Entrypoint setup.

/// The main entrypoint which sets up global state.
#[cfg(not(feature = "wasm_no_main"))]
#[wasm_bindgen(start)]
pub fn main() {
set_panic_hook();
}

/// Sets the panic hook to print to the console.
#[wasm_bindgen]
pub fn set_panic_hook() {
panic::set_hook(Box::new(console_error_panic_hook::hook));
}

// [`Note`] ABI.

/// The [`Note`] wrapper.
Expand Down

0 comments on commit 9f88548

Please sign in to comment.