@@ -4,11 +4,11 @@ use crate::sys;
4
4
use std:: convert:: { AsMut , AsRef , TryFrom , TryInto } ;
5
5
use std:: hash:: { Hash , Hasher } ;
6
6
use std:: mem;
7
+ use std:: num:: TryFromIntError ;
7
8
use std:: ops:: {
8
9
Add , AddAssign , BitAnd , BitOr , Deref , DerefMut , Div , DivAssign , Mul , MulAssign , Neg , Sub ,
9
10
SubAssign ,
10
11
} ;
11
- use std:: num:: TryFromIntError ;
12
12
use std:: ptr;
13
13
14
14
/// The maximal integer value that can be used for rectangles.
@@ -709,17 +709,22 @@ impl From<(i32, i32, u32, u32)> for Rect {
709
709
///
710
710
/// assert_eq!(rect1, rect2);
711
711
/// ```
712
- impl < T > TryFrom < [ T ; 4 ] > for Rect where
713
- T : TryInto < u32 > + TryInto < i32 > ,
714
- // need to do this to support Infallible conversions
715
- TryFromIntError : From < <T as TryInto < i32 > >:: Error > ,
716
- TryFromIntError : From < <T as TryInto < u32 > >:: Error > ,
712
+ impl < T > TryFrom < [ T ; 4 ] > for Rect
713
+ where
714
+ T : TryInto < u32 > + TryInto < i32 > ,
715
+ // need to do this to support Infallible conversions
716
+ TryFromIntError : From < <T as TryInto < i32 > >:: Error > ,
717
+ TryFromIntError : From < <T as TryInto < u32 > >:: Error > ,
717
718
{
718
- type Error = TryFromIntError ;
719
- fn try_from ( [ x, y, width, height] : [ T ; 4 ] ) -> Result < Self , TryFromIntError > {
720
- Ok ( Rect :: new ( x. try_into ( ) ?, y. try_into ( ) ?,
721
- width. try_into ( ) ?, height. try_into ( ) ?) )
722
- }
719
+ type Error = TryFromIntError ;
720
+ fn try_from ( [ x, y, width, height] : [ T ; 4 ] ) -> Result < Self , TryFromIntError > {
721
+ Ok ( Rect :: new (
722
+ x. try_into ( ) ?,
723
+ y. try_into ( ) ?,
724
+ width. try_into ( ) ?,
725
+ height. try_into ( ) ?,
726
+ ) )
727
+ }
723
728
}
724
729
725
730
impl AsRef < sys:: SDL_Rect > for Rect {
0 commit comments