@@ -68,10 +68,10 @@ macro_rules! impl_builtin_traits_inner {
68
68
impl Eq for $Type { }
69
69
} ;
70
70
71
- ( PartialOrd for $Type: ty => $gd_method: ident ) => {
72
- impl PartialOrd for $Type {
71
+ ( Ord for $Type: ty => $gd_method: ident ) => {
72
+ impl Ord for $Type {
73
73
#[ inline]
74
- fn partial_cmp ( & self , other: & Self ) -> Option < std:: cmp:: Ordering > {
74
+ fn cmp ( & self , other: & Self ) -> std:: cmp:: Ordering {
75
75
let op_less = |lhs, rhs| unsafe {
76
76
let mut result = false ;
77
77
:: godot_ffi:: builtin_call! {
@@ -81,22 +81,18 @@ macro_rules! impl_builtin_traits_inner {
81
81
} ;
82
82
83
83
if op_less( self . sys( ) , other. sys( ) ) {
84
- Some ( std:: cmp:: Ordering :: Less )
84
+ std:: cmp:: Ordering :: Less
85
85
} else if op_less( other. sys( ) , self . sys( ) ) {
86
- Some ( std:: cmp:: Ordering :: Greater )
86
+ std:: cmp:: Ordering :: Greater
87
87
} else {
88
- Some ( std:: cmp:: Ordering :: Equal )
88
+ std:: cmp:: Ordering :: Equal
89
89
}
90
90
}
91
91
}
92
- } ;
93
-
94
- ( Ord for $Type: ty => $gd_method: ident ) => {
95
- impl_builtin_traits_inner!( PartialOrd for $Type => $gd_method) ;
96
- impl Ord for $Type {
92
+ impl PartialOrd for $Type {
97
93
#[ inline]
98
- fn cmp ( & self , other: & Self ) -> std:: cmp:: Ordering {
99
- PartialOrd :: partial_cmp ( self , other ) . expect ( "PartialOrd::partial_cmp" )
94
+ fn partial_cmp ( & self , other: & Self ) -> Option < std:: cmp:: Ordering > {
95
+ Some ( self . cmp ( other ) )
100
96
}
101
97
}
102
98
} ;
0 commit comments