🚨 Fix clippy warnings

main
_ 2020-02-17 02:09:13 +00:00
parent a41eb8b969
commit c4d6243d15
4 changed files with 6 additions and 13 deletions

View File

@ -2,8 +2,6 @@ use glam::{Mat4, Vec3, Vec4};
use sdl2::event::Event; use sdl2::event::Event;
use sdl2::keyboard::{Keycode, Scancode}; use sdl2::keyboard::{Keycode, Scancode};
use std::collections::HashMap;
use std::ffi::{c_void};
use std::time::{Duration}; use std::time::{Duration};
use opengl_rust::*; use opengl_rust::*;
@ -107,10 +105,7 @@ fn main () {
.unwrap (); .unwrap ();
gl::load_with (|s| { gl::load_with (|s| {
let result = video_subsystem.gl_get_proc_address (s) as *const _; video_subsystem.gl_get_proc_address (s) as *const _
//println! ("{:?}", result);
result
}); });
assert! (gl::ClearColor::is_loaded ()); assert! (gl::ClearColor::is_loaded ());
@ -160,8 +155,6 @@ fn main () {
let renderable_sky = glezz::RenderableModel::from_iqm (&sky_model); let renderable_sky = glezz::RenderableModel::from_iqm (&sky_model);
const FALSE_U8: u8 = 0;
glezz::enable_vertex_attrib_array (attrs ["pos"]); glezz::enable_vertex_attrib_array (attrs ["pos"]);
glezz::enable_vertex_attrib_array (attrs ["uv"]); glezz::enable_vertex_attrib_array (attrs ["uv"]);
glezz::enable_vertex_attrib_array (attrs ["normal"]); glezz::enable_vertex_attrib_array (attrs ["normal"]);
@ -256,7 +249,7 @@ fn main () {
window.gl_swap_window (); window.gl_swap_window ();
::std::thread::sleep (Duration::from_millis (15)); std::thread::sleep (Duration::from_millis (15));
} }
} }

View File

@ -12,7 +12,7 @@ use crate::iqm;
pub fn clear_color (r: f32, g: f32, b: f32, a: f32) { pub fn clear_color (r: f32, g: f32, b: f32, a: f32) {
unsafe { unsafe {
gl::ClearColor (1.0f32, 1.0f32, 1.0f32, 1.0f32); gl::ClearColor (r, g, b, a);
} }
} }
@ -89,7 +89,7 @@ impl VertexBuffer {
gl::GenBuffers (1, &mut id); gl::GenBuffers (1, &mut id);
gl::BindBuffer (gl::ARRAY_BUFFER, id); gl::BindBuffer (gl::ARRAY_BUFFER, id);
gl::BufferData (gl::ARRAY_BUFFER, (slice.len () * 4).try_into ().unwrap (), &slice [0] as *const f32 as *const c_void, gl::STATIC_DRAW); gl::BufferData (gl::ARRAY_BUFFER, (slice.len () * FLOAT_SIZE).try_into ().unwrap (), &slice [0] as *const f32 as *const c_void, gl::STATIC_DRAW);
} }
assert! (id != 0); assert! (id != 0);
id id

View File

@ -6,7 +6,7 @@ use nom::{
use std::convert::TryInto; use std::convert::TryInto;
mod consts { pub mod consts {
pub const VERSION: usize = 0; pub const VERSION: usize = 0;
pub const FILESIZE: usize = 1; pub const FILESIZE: usize = 1;
pub const FLAGS: usize = 2; pub const FLAGS: usize = 2;

View File

@ -56,7 +56,7 @@ impl Drop for Texture {
} }
unsafe { unsafe {
gl::DeleteTextures (1, &mut self.id); gl::DeleteTextures (1, &self.id);
} }
self.id = 0; self.id = 0;