@@ -92,13 +92,12 @@ extern "C" fn class_singleton_static_invoke(
9292 . expect ( "Unable to get method name" ) ;
9393 let ret = class. call ( name, args) ;
9494 std:: mem:: forget ( class) ;
95- std:: mem:: forget ( name) ;
9695 ret
9796 } ;
9897 if let Ok ( ret) = ret {
99- return ret;
98+ ret
10099 } else {
101- return 0 as OpaqueType ;
100+ 0 as OpaqueType
102101 }
103102}
104103
@@ -116,12 +115,10 @@ extern "C" fn class_singleton_static_await(
116115
117116#[ no_mangle]
118117extern "C" fn class_singleton_destroy ( _klass : OpaqueType , class_impl : OpaqueType ) {
119- if !rs_loader_destroyed ( ) {
120- if !class_impl. is_null ( ) {
121- unsafe {
122- let class = Box :: from_raw ( class_impl as * mut class:: Class ) ;
123- drop ( class) ;
124- }
118+ if !rs_loader_destroyed ( ) && !class_impl. is_null ( ) {
119+ unsafe {
120+ let class = Box :: from_raw ( class_impl as * mut class:: Class ) ;
121+ drop ( class) ;
125122 }
126123 }
127124}
@@ -239,10 +236,8 @@ pub fn register_class(class_registration: ClassRegistration) {
239236 loader_impl_type ( class_registration. loader_impl , ret. as_ptr ( ) ) ,
240237 ) ;
241238 } ;
242- }
243- else {
244- let ret = CString :: new ( "Null" )
245- . expect ( "Failed to convert return type to C string" ) ;
239+ } else {
240+ let ret = CString :: new ( "Null" ) . expect ( "Failed to convert return type to C string" ) ;
246241
247242 unsafe {
248243 signature_set_return (
@@ -294,10 +289,8 @@ pub fn register_class(class_registration: ClassRegistration) {
294289 loader_impl_type ( class_registration. loader_impl , ret. as_ptr ( ) ) ,
295290 ) ;
296291 } ;
297- }
298- else {
299- let ret = CString :: new ( "Null" )
300- . expect ( "Failed to convert return type to C string" ) ;
292+ } else {
293+ let ret = CString :: new ( "Null" ) . expect ( "Failed to convert return type to C string" ) ;
301294
302295 unsafe {
303296 signature_set_return (
0 commit comments