File tree Expand file tree Collapse file tree 4 files changed +17
-22
lines changed Expand file tree Collapse file tree 4 files changed +17
-22
lines changed Original file line number Diff line number Diff line change @@ -91,6 +91,6 @@ impl_basic_traits_as_sys! {
91
91
for Rid as godot_rid {
92
92
Default => godot_rid_new;
93
93
Eq => godot_rid_operator_equal;
94
- PartialOrd => godot_rid_operator_less;
94
+ Ord => godot_rid_operator_less;
95
95
}
96
96
}
Original file line number Diff line number Diff line change @@ -592,7 +592,7 @@ impl_basic_traits_as_sys! {
592
592
for StringName as godot_string_name {
593
593
Drop => godot_string_name_destroy;
594
594
Eq => godot_string_name_operator_equal;
595
- PartialOrd => godot_string_name_operator_less;
595
+ Ord => godot_string_name_operator_less;
596
596
}
597
597
}
598
598
Original file line number Diff line number Diff line change @@ -603,7 +603,7 @@ impl_basic_traits_as_sys!(
603
603
Drop => godot_variant_destroy;
604
604
Clone => godot_variant_new_copy;
605
605
PartialEq => godot_variant_operator_equal;
606
- PartialOrd => godot_variant_operator_less;
606
+ Ord => godot_variant_operator_less;
607
607
}
608
608
) ;
609
609
Original file line number Diff line number Diff line change @@ -174,30 +174,25 @@ macro_rules! impl_basic_trait_as_sys {
174
174
} ;
175
175
176
176
(
177
- PartialOrd for $Type: ty as $GdType: ident : $gd_method: ident
177
+ Ord for $Type: ty as $GdType: ident : $gd_method: ident
178
178
) => {
179
179
impl PartialOrd for $Type {
180
- #[ inline]
181
- fn partial_cmp( & self , other: & Self ) -> Option <std:: cmp:: Ordering > {
182
- if self == other {
183
- Some ( std:: cmp:: Ordering :: Equal )
184
- } else if unsafe { ( get_api( ) . $gd_method) ( & self . 0 , & other. 0 ) } {
185
- Some ( std:: cmp:: Ordering :: Less )
186
- } else {
187
- Some ( std:: cmp:: Ordering :: Greater )
188
- }
180
+ #[ inline]
181
+ fn partial_cmp( & self , other: & Self ) -> Option <std:: cmp:: Ordering > {
182
+ Some ( self . cmp( other) )
189
183
}
190
184
}
191
- } ;
192
-
193
- (
194
- Ord for $Type: ty as $GdType: ident : $gd_method: ident
195
- ) => {
196
- impl_basic_trait_as_sys!( PartialOrd for $Type as $GdType : $gd_method) ;
197
185
impl Ord for $Type {
198
- #[ inline]
199
- fn cmp( & self , other: & Self ) -> std:: cmp:: Ordering {
200
- self . partial_cmp( other) . unwrap( )
186
+ #[ inline]
187
+ fn cmp( & self , other: & Self ) -> std:: cmp:: Ordering {
188
+ let op_less = get_api( ) . $gd_method;
189
+ if unsafe { op_less( & self . 0 , & other. 0 ) } {
190
+ std:: cmp:: Ordering :: Less
191
+ } else if unsafe { op_less( & other. 0 , & self . 0 ) } {
192
+ std:: cmp:: Ordering :: Greater
193
+ } else {
194
+ std:: cmp:: Ordering :: Equal
195
+ }
201
196
}
202
197
}
203
198
} ;
You can’t perform that action at this time.
0 commit comments