@@ -187,7 +187,10 @@ pub(crate) enum FromGodotError {
187
187
188
188
/// Special case of `BadArrayType` where a custom int type such as `i8` cannot hold a dynamic `i64` value.
189
189
#[ cfg( debug_assertions) ]
190
- BadArrayTypeInt { expected : ArrayTypeInfo , value : i64 } ,
190
+ BadArrayTypeInt {
191
+ expected_int_type : & ' static str ,
192
+ value : i64 ,
193
+ } ,
191
194
192
195
/// InvalidEnum is also used by bitfields.
193
196
InvalidEnum ,
@@ -219,39 +222,23 @@ impl fmt::Display for FromGodotError {
219
222
match self {
220
223
Self :: BadArrayType { expected, actual } => {
221
224
if expected. variant_type ( ) != actual. variant_type ( ) {
222
- return if expected. is_typed ( ) {
223
- write ! (
224
- f,
225
- "expected array of type {:?}, got array of type {:?}" ,
226
- expected. variant_type( ) ,
227
- actual. variant_type( )
228
- )
229
- } else {
230
- write ! (
231
- f,
232
- "expected untyped array, got array of type {:?}" ,
233
- actual. variant_type( )
234
- )
235
- } ;
225
+ // Includes either of two sides being Untyped (VARIANT).
226
+ return write ! ( f, "expected array of type {expected:?}, got {actual:?}" ) ;
236
227
}
237
228
238
- let exp_class = expected. class_name ( ) . expect ( "lhs class name present" ) ;
239
- let act_class = actual. class_name ( ) . expect ( "rhs class name present" ) ;
240
- assert_ne ! (
241
- exp_class, act_class,
242
- "BadArrayType with expected == got, this is a gdext bug"
243
- ) ;
229
+ let exp_class = format ! ( "{expected:?}" ) ;
230
+ let act_class = format ! ( "{actual:?}" ) ;
244
231
245
- write ! (
246
- f,
247
- "expected array of class {exp_class}, got array of class {act_class}"
248
- )
232
+ write ! ( f, "expected array of type {exp_class}, got {act_class}" )
249
233
}
250
234
#[ cfg( debug_assertions) ]
251
- Self :: BadArrayTypeInt { expected, value } => {
235
+ Self :: BadArrayTypeInt {
236
+ expected_int_type,
237
+ value,
238
+ } => {
252
239
write ! (
253
240
f,
254
- "integer value {value} does not fit into Array of type {expected:?} "
241
+ "integer value {value} does not fit into Array<{expected_int_type}> "
255
242
)
256
243
}
257
244
Self :: InvalidEnum => write ! ( f, "invalid engine enum value" ) ,
0 commit comments