Skip to content

Commit

Permalink
fix compilation errors with the gfx feature enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitmel committed Dec 3, 2019
1 parent 9239496 commit 584210c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/sdl2/gfx/primitives.rs
Expand Up @@ -3,7 +3,7 @@
use std::mem;
use std::ptr;
use std::ffi::CString;
use num::traits::ToPrimitive;
use std::convert::TryFrom;
use libc::{c_int, c_char};
use libc::c_void;
use render::Canvas;
Expand Down Expand Up @@ -57,12 +57,12 @@ impl ToColor for u32 {
impl ToColor for isize {
#[inline]
fn as_rgba(&self) -> (u8, u8, u8, u8) {
unsafe { mem::transmute(self.to_u32().expect("Can't convert to Color Type")) }
unsafe { mem::transmute(u32::try_from(*self).expect("Can't convert to Color Type")) }
}

#[inline]
fn as_u32(&self) -> u32 {
self.to_u32().expect("Can't convert to Color Type")
u32::try_from(*self).expect("Can't convert to Color Type")
}
}

Expand Down

0 comments on commit 584210c

Please sign in to comment.