Skip to content

Commit 584210c

Browse files
committed
fix compilation errors with the gfx feature enabled
1 parent 9239496 commit 584210c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/sdl2/gfx/primitives.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use std::mem;
44
use std::ptr;
55
use std::ffi::CString;
6-
use num::traits::ToPrimitive;
6+
use std::convert::TryFrom;
77
use libc::{c_int, c_char};
88
use libc::c_void;
99
use render::Canvas;
@@ -57,12 +57,12 @@ impl ToColor for u32 {
5757
impl ToColor for isize {
5858
#[inline]
5959
fn as_rgba(&self) -> (u8, u8, u8, u8) {
60-
unsafe { mem::transmute(self.to_u32().expect("Can't convert to Color Type")) }
60+
unsafe { mem::transmute(u32::try_from(*self).expect("Can't convert to Color Type")) }
6161
}
6262

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

0 commit comments

Comments
 (0)