Skip to content

Commit

Permalink
fix lints reported by cargo check and clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitmel committed Jul 6, 2021
1 parent d61c7b8 commit 4b96e7d
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 15 deletions.
2 changes: 1 addition & 1 deletion crates/cardboard_oogl/examples/textured_cube.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ fn main() {
.set(&bound_program, &Mat4f::look_to_rh(CAMERA_POS, Vec3f::ZERO - CAMERA_POS, Vec3f::UP));

let reset_viewport = |gl: &Context, window: &Window| {
common::reset_gl_viewport(&gl, &window);
common::reset_gl_viewport(gl, window);
let (w, h) = window.drawable_size();
let aspect = w as f32 / h as f32;
uni_proj_mat.set(
Expand Down
4 changes: 2 additions & 2 deletions crates/cardboard_oogl/src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ where
T: Copy,
{
#[inline(always)]
fn object(&self) -> &VertexBuffer<T> { &self.buffer }
fn object(&self) -> &VertexBuffer<T> { self.buffer }

fn unbind_completely(self) {
self.ctx().bound_vertex_buffer.unbind_unconditionally(self.raw_gl());
Expand Down Expand Up @@ -206,7 +206,7 @@ where
T: BufferIndex,
{
#[inline(always)]
fn object(&self) -> &ElementBuffer<T> { &self.buffer }
fn object(&self) -> &ElementBuffer<T> { self.buffer }

fn unbind_completely(self) {
self.ctx().bound_element_buffer.unbind_unconditionally(self.raw_gl());
Expand Down
2 changes: 1 addition & 1 deletion crates/cardboard_oogl/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use prelude_plus::*;
pub type SharedContext = Rc<Context>;
impl Context {
#[inline(always)]
pub fn share(self: &SharedContext) -> SharedContext { Rc::clone(&self) }
pub fn share(self: &SharedContext) -> SharedContext { Rc::clone(self) }
}

pub struct Context {
Expand Down
2 changes: 1 addition & 1 deletion crates/cardboard_oogl/src/framebuffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub struct FramebufferBinding<'obj> {

unsafe impl<'obj> ObjectBinding<'obj, Framebuffer> for FramebufferBinding<'obj> {
#[inline(always)]
fn object(&self) -> &Framebuffer { &self.framebuffer }
fn object(&self) -> &Framebuffer { self.framebuffer }

fn unbind_completely(self) {
self.ctx().bound_framebuffer.unbind_unconditionally(self.raw_gl());
Expand Down
6 changes: 3 additions & 3 deletions crates/cardboard_oogl/src/shader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ impl Program {
}

let (location, data_type) =
check_uniform_type(&self, name, T::CORRESPONDING_UNIFORM_TYPES, type_name::<T>());
check_uniform_type(self, name, T::CORRESPONDING_UNIFORM_TYPES, type_name::<T>());
Uniform { location, program_addr: self.addr, data_type, phantom: PhantomData }
}

Expand Down Expand Up @@ -376,7 +376,7 @@ impl Program {
}

let (location, data_type) =
check_attrib_type(&self, name, T::CORRESPONDING_ATTRIB_TYPES, std::any::type_name::<T>());
check_attrib_type(self, name, T::CORRESPONDING_ATTRIB_TYPES, std::any::type_name::<T>());
Attrib { location, program_addr: self.addr, data_type, phantom: PhantomData }
}

Expand All @@ -396,7 +396,7 @@ pub struct ProgramBinding<'obj> {

unsafe impl<'obj> ObjectBinding<'obj, Program> for ProgramBinding<'obj> {
#[inline(always)]
fn object(&self) -> &Program { &self.program }
fn object(&self) -> &Program { self.program }

fn unbind_completely(self) { self.ctx().bound_program.unbind_unconditionally(self.raw_gl()); }
}
Expand Down
2 changes: 1 addition & 1 deletion crates/cardboard_oogl/src/texture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ where
T: TextureDataType,
{
#[inline(always)]
fn object(&self) -> &Texture2D<T> { &self.texture }
fn object(&self) -> &Texture2D<T> { self.texture }

fn unbind_completely(self) { self.ctx().bound_texture_2d.unbind_unconditionally(self.raw_gl()); }
}
Expand Down
2 changes: 1 addition & 1 deletion src/globals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub struct Globals {

impl Globals {
#[inline(always)]
pub fn share(self: &SharedGlobals) -> SharedGlobals { Rc::clone(&self) }
pub fn share(self: &SharedGlobals) -> SharedGlobals { Rc::clone(self) }
}

#[derive(Debug)]
Expand Down
11 changes: 8 additions & 3 deletions src/image_decoding_speedrun.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,14 @@ pub fn multi_threaded_main() -> AssetsMap {
}

let jobs_count = num_cpus::get();
let jobs: Vec<_> = (0..jobs_count)
.map(|i| asset_loading_job(i, Arc::clone(&assets), Arc::clone(&decoding_requests_recv_locked)))
.collect();
let mut jobs = Vec::<thread::JoinHandle<()>>::with_capacity(jobs_count);
for i in 0..jobs_count {
jobs.push(asset_loading_job(
i,
Arc::clone(&assets),
Arc::clone(&decoding_requests_recv_locked),
))
}

for path in asset_paths {
decoding_requests_send.send(path).expect("decoding requests channel has been broken");
Expand Down
3 changes: 3 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,11 @@ fn try_main() -> AnyResult<()> {
struct Game {
pub globals: SharedGlobals,

#[allow(dead_code)]
pub sdl_context: sdl2::Sdl,
#[allow(dead_code)]
pub video_subsystem: sdl2::VideoSubsystem,
#[allow(dead_code)]
pub sdl_gl_ctx: sdl2::video::GLContext,
pub window: Window,
pub event_pump: EventPump,
Expand Down
2 changes: 1 addition & 1 deletion src/marching_squares.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,5 +369,5 @@ fn copy_data_from_vec_into_buffer<'obj, Obj: 'obj, T>(
} else {
buffer.orphan_data();
}
buffer.set_slice(0..data_vec.len(), &data_vec);
buffer.set_slice(0..data_vec.len(), data_vec);
}
2 changes: 1 addition & 1 deletion src/pong.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ impl Pong {
(&mut *left_racket, &mut *left_racket_controller),
(&mut *right_racket, &mut *right_racket_controller),
] {
let dir = controller.get_movement_direction(&self.globals, &racket, &ball);
let dir = controller.get_movement_direction(&self.globals, racket, ball);
racket.coll.accel.y = dir * RACKET_MAX_SPEED * RACKET_ACCELERATION;
}

Expand Down

0 comments on commit 4b96e7d

Please sign in to comment.