From e3d70f63c2402b390ac86c53e321e97b3c3851ec Mon Sep 17 00:00:00 2001 From: Dario Ostuni Date: Sat, 23 Sep 2017 21:06:08 +0200 Subject: [PATCH] Sync with `master` --- examples/game-of-life-unsafe-textures.rs | 4 ++-- examples/game-of-life.rs | 2 +- examples/resource-manager.rs | 4 ++-- src/sdl2/mixer/mod.rs | 6 ++++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/examples/game-of-life-unsafe-textures.rs b/examples/game-of-life-unsafe-textures.rs index 01beb2e8..08c971da 100644 --- a/examples/game-of-life-unsafe-textures.rs +++ b/examples/game-of-life-unsafe-textures.rs @@ -86,7 +86,7 @@ mod game_of_life { pub fn update(&mut self) { let mut new_playground = self.playground; - for (u, mut square) in new_playground.iter_mut().enumerate() { + for (u, square) in new_playground.iter_mut().enumerate() { let u = u as u32; let x = u % PLAYGROUND_WIDTH; let y = u / PLAYGROUND_WIDTH; @@ -252,7 +252,7 @@ pub fn main() { let x = (x as u32) / SQUARE_SIZE; let y = (y as u32) / SQUARE_SIZE; match game.get_mut(x as i32, y as i32) { - Some(mut square) => {*square = !(*square);}, + Some(square) => {*square = !(*square);}, None => {panic!()} }; }, diff --git a/examples/game-of-life.rs b/examples/game-of-life.rs index 67dd0ebf..817cee83 100644 --- a/examples/game-of-life.rs +++ b/examples/game-of-life.rs @@ -115,7 +115,7 @@ mod game_of_life { } } -fn dummy_texture<'a>(canvas: &mut Canvas, texture_creator: &'a TextureCreator) -> (Texture<'a>, Texture<'a>) { +fn dummy_texture<'a>(canvas: &mut Canvas, texture_creator: &'a TextureCreator) -> (Texture, Texture) { enum TextureColor { Yellow, White, diff --git a/examples/resource-manager.rs b/examples/resource-manager.rs index 84312218..9e0ff52c 100644 --- a/examples/resource-manager.rs +++ b/examples/resource-manager.rs @@ -70,7 +70,7 @@ fn main() { } } -type TextureManager<'l, T> = ResourceManager<'l, String, Texture<'l>, TextureCreator>; +type TextureManager<'l, T> = ResourceManager<'l, String, Texture, TextureCreator>; type FontManager<'l> = ResourceManager<'l, FontDetails, Font<'l, 'static>, Sdl2TtfContext>; // Generic struct to cache any resource loaded by a ResourceLoader @@ -113,7 +113,7 @@ impl<'l, K, R, L> ResourceManager<'l, K, R, L> } // TextureCreator knows how to load Textures -impl<'l, T> ResourceLoader<'l, Texture<'l>> for TextureCreator { +impl<'l, T> ResourceLoader<'l, Texture> for TextureCreator { type Args = str; fn load(&'l self, path: &str) -> Result { println!("LOADED A TEXTURE"); diff --git a/src/sdl2/mixer/mod.rs b/src/sdl2/mixer/mod.rs index 8b1ad941..b614c94a 100644 --- a/src/sdl2/mixer/mod.rs +++ b/src/sdl2/mixer/mod.rs @@ -27,10 +27,12 @@ use std::ffi::{CString, CStr}; use std::str::from_utf8; use std::borrow::ToOwned; use std::path::Path; -use libc::{c_int, uint16_t, c_double, c_uint, c_void}; +use std::os::raw::c_void; +use libc::{c_int, uint16_t, c_double, c_uint}; use ::get_error; use ::rwops::RWops; use ::version::Version; +use sys; // Setup linking for all targets. #[cfg(target_os="macos")] @@ -793,7 +795,7 @@ impl<'a> Music<'a> { /// Load music from a static byte buffer. pub fn from_static_bytes(buf: &'static [u8]) -> Result, String> { let rw = unsafe { - ::sys::rwops::SDL_RWFromConstMem(buf.as_ptr() as *const c_void, buf.len() as c_int) + sys::SDL_RWFromConstMem(buf.as_ptr() as *const c_void, buf.len() as c_int) }; if rw.is_null() {