From 1799dcb92370aa15fa37f08623c138b3578f172d Mon Sep 17 00:00:00 2001 From: Bernie Innocenti Date: Wed, 21 Jun 2017 18:20:32 -0400 Subject: [PATCH] Simplify SoundPlayer's hit_event(). --- sound.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sound.rs b/sound.rs index 859decf..ca313b8 100644 --- a/sound.rs +++ b/sound.rs @@ -64,9 +64,7 @@ pub fn start() -> SoundPlayer { pub fn hit_event(player: &mut SoundPlayer) -> f32 { use std::ops::Deref; - let maybe_audio_device = &mut player.device; - let audio_device = &mut maybe_audio_device.as_mut().unwrap(); - let audio_device_lock = audio_device.lock(); + let audio_device_lock = player.device.as_mut().unwrap().lock(); let xm_callback = audio_device_lock.deref(); let xm = &xm_callback.xm; let n_samples = xm.latest_trigger_of_instrument(0x1D); -- 2.25.1