We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9239496 commit 584210cCopy full SHA for 584210c
src/sdl2/gfx/primitives.rs
@@ -3,7 +3,7 @@
3
use std::mem;
4
use std::ptr;
5
use std::ffi::CString;
6
-use num::traits::ToPrimitive;
+use std::convert::TryFrom;
7
use libc::{c_int, c_char};
8
use libc::c_void;
9
use render::Canvas;
@@ -57,12 +57,12 @@ impl ToColor for u32 {
57
impl ToColor for isize {
58
#[inline]
59
fn as_rgba(&self) -> (u8, u8, u8, u8) {
60
- 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")) }
61
}
62
63
64
fn as_u32(&self) -> u32 {
65
- self.to_u32().expect("Can't convert to Color Type")
+ u32::try_from(*self).expect("Can't convert to Color Type")
66
67
68
0 commit comments