File tree Expand file tree Collapse file tree 1 file changed +2
-15
lines changed Expand file tree Collapse file tree 1 file changed +2
-15
lines changed Original file line number Diff line number Diff line change @@ -115,21 +115,8 @@ impl<T: GodotClass> RawGd<T> {
115
115
where
116
116
U : GodotClass ,
117
117
{
118
- if self . is_null ( ) {
119
- // Null can be cast to anything.
120
- return true ;
121
- }
122
-
123
- // SAFETY: object is forgotten below.
124
- let as_obj =
125
- unsafe { self . ffi_cast :: < classes:: Object > ( ) } . expect ( "everything inherits Object" ) ;
126
-
127
- // SAFETY: Object is always a base class.
128
- let cast_is_valid = unsafe { as_obj. as_upcast_ref :: < classes:: Object > ( ) }
129
- . is_class ( & U :: class_name ( ) . to_gstring ( ) ) ;
130
-
131
- std:: mem:: forget ( as_obj) ;
132
- cast_is_valid
118
+ self . is_null ( ) // Null can be cast to anything.
119
+ || self . as_object_ref ( ) . is_class ( & U :: class_name ( ) . to_gstring ( ) )
133
120
}
134
121
135
122
/// Returns `Ok(cast_obj)` on success, `Err(self)` on error
You can’t perform that action at this time.
0 commit comments