From 4d6768c01530079bcc66c5284df74a875c647a6c Mon Sep 17 00:00:00 2001 From: Alula <6276139+alula@users.noreply.github.com> Date: Sat, 8 Jan 2022 06:15:30 +0100 Subject: [PATCH] fix few warnings --- src/framework/backend_sdl2.rs | 9 ++++----- src/sound/ogg_playback.rs | 1 - 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/framework/backend_sdl2.rs b/src/framework/backend_sdl2.rs index f5d93b6..4249457 100644 --- a/src/framework/backend_sdl2.rs +++ b/src/framework/backend_sdl2.rs @@ -1,6 +1,5 @@ use core::mem; use std::any::Any; -use std::borrow::Borrow; use std::cell::{RefCell, UnsafeCell}; use std::ffi::c_void; use std::ops::Deref; @@ -223,10 +222,8 @@ impl BackendEventLoop for SDL2EventLoop { game.update(ctx).unwrap(); - if state.next_scene.is_some() { - mem::swap(&mut game.scene, &mut state.next_scene); - state.next_scene = None; - + if let Some(_) = &state.next_scene { + game.scene = mem::take(&mut state.next_scene); game.scene.as_mut().unwrap().init(state, ctx).unwrap(); game.loops = 0; state.frame_time = 0.0; @@ -237,6 +234,7 @@ impl BackendEventLoop for SDL2EventLoop { self.refs.deref().borrow().canvas.window(), &self.event_pump.mouse_state(), ); + game.draw(ctx).unwrap(); } } @@ -304,6 +302,7 @@ struct SDL2Renderer { refs: Rc>, imgui: Rc>, imgui_event: Rc>, + #[allow(unused)] // the rendering pipeline uses pointers to SDL_Texture, and we manually manage the lifetimes imgui_font_tex: SDL2Texture, } diff --git a/src/sound/ogg_playback.rs b/src/sound/ogg_playback.rs index b0192ae..b76b37a 100644 --- a/src/sound/ogg_playback.rs +++ b/src/sound/ogg_playback.rs @@ -4,7 +4,6 @@ use lewton::inside_ogg::OggStreamReader; use num_traits::clamp; use crate::framework::filesystem::File; -use crate::sound::stuff::cubic_interp; use crate::sound::wav::WavFormat; pub(crate) struct OggPlaybackEngine {