@@ -258,7 +258,7 @@ impl<'lua, 'scope> Scope<'lua, 'scope> {
258258 if ffi:: lua_getmetatable ( lua. state , -1 ) == 0 {
259259 return Err ( Error :: UserDataTypeMismatch ) ;
260260 }
261- ffi:: lua_pushstring ( lua. state , cstr ! ( "__mlua " ) ) ;
261+ ffi:: lua_pushstring ( lua. state , cstr ! ( "__mlua_ptr " ) ) ;
262262 if ffi:: lua_rawget ( lua. state , -2 ) == ffi:: LUA_TLIGHTUSERDATA {
263263 let ud_ptr = ffi:: lua_touserdata ( lua. state , -1 ) ;
264264 if ud_ptr == check_data. as_ptr ( ) as * mut c_void {
@@ -329,7 +329,7 @@ impl<'lua, 'scope> Scope<'lua, 'scope> {
329329 ffi:: lua_newtable ( state) ;
330330
331331 // Add internal metamethod to store reference to the data
332- ffi:: lua_pushstring ( state, cstr ! ( "__mlua " ) ) ;
332+ ffi:: lua_pushstring ( state, cstr ! ( "__mlua_ptr " ) ) ;
333333 ffi:: lua_pushlightuserdata ( lua. state , data. as_ptr ( ) as * mut c_void ) ;
334334 ffi:: lua_rawset ( state, -3 ) ;
335335 } ) ?;
@@ -352,7 +352,7 @@ impl<'lua, 'scope> Scope<'lua, 'scope> {
352352 let metatable_index = ffi:: lua_absindex ( lua. state , -1 ) ;
353353
354354 let mut field_getters_index = None ;
355- if ud_fields. field_getters . len ( ) > 0 {
355+ if ! ud_fields. field_getters . is_empty ( ) {
356356 protect_lua_closure ( lua. state , 0 , 1 , |state| {
357357 ffi:: lua_newtable ( state) ;
358358 } ) ?;
@@ -368,7 +368,7 @@ impl<'lua, 'scope> Scope<'lua, 'scope> {
368368 }
369369
370370 let mut field_setters_index = None ;
371- if ud_fields. field_setters . len ( ) > 0 {
371+ if ! ud_fields. field_setters . is_empty ( ) {
372372 protect_lua_closure ( lua. state , 0 , 1 , |state| {
373373 ffi:: lua_newtable ( state) ;
374374 } ) ?;
@@ -384,7 +384,7 @@ impl<'lua, 'scope> Scope<'lua, 'scope> {
384384 }
385385
386386 let mut methods_index = None ;
387- if ud_methods. methods . len ( ) > 0 {
387+ if ! ud_methods. methods . is_empty ( ) {
388388 // Create table used for methods lookup
389389 protect_lua_closure ( lua. state , 0 , 1 , |state| {
390390 ffi:: lua_newtable ( state) ;
@@ -430,7 +430,8 @@ impl<'lua, 'scope> Scope<'lua, 'scope> {
430430
431431 // We know the destructor has not run yet because we hold a reference to the
432432 // userdata.
433- vec ! [ Box :: new( take_userdata:: <( ) >( state) ) ]
433+ take_userdata :: < ( ) > ( state) ;
434+ vec ! [ ]
434435 } ) ) ;
435436
436437 Ok ( ud)
@@ -730,6 +731,7 @@ impl<'lua, T: UserData> UserDataMethods<'lua, T> for NonStaticUserDataMethods<'l
730731struct NonStaticUserDataFields < ' lua , T : UserData > {
731732 field_getters : Vec < ( Vec < u8 > , NonStaticMethod < ' lua , T > ) > ,
732733 field_setters : Vec < ( Vec < u8 > , NonStaticMethod < ' lua , T > ) > ,
734+ #[ allow( clippy:: type_complexity) ]
733735 meta_fields : Vec < ( MetaMethod , Box < dyn Fn ( & ' lua Lua ) -> Result < Value < ' lua > > > ) > ,
734736}
735737
0 commit comments