@@ -71,7 +71,7 @@ pub fn add_methods<'lua, M: LuaUserDataMethods<'lua, Instance>>(m: &mut M) {
7171 "FindFirstAncestorWhichIsA" ,
7272 |lua, this, class_name : String | {
7373 ensure_not_destroyed ( this) ?;
74- this. find_ancestor ( |child| class_is_a ( & child. class , & class_name) . unwrap_or ( false ) )
74+ this. find_ancestor ( |child| class_is_a ( child. class , & class_name) . unwrap_or ( false ) )
7575 . into_lua ( lua)
7676 } ,
7777 ) ;
@@ -104,7 +104,7 @@ pub fn add_methods<'lua, M: LuaUserDataMethods<'lua, Instance>>(m: &mut M) {
104104 |lua, this, ( class_name, recursive) : ( String , Option < bool > ) | {
105105 ensure_not_destroyed ( this) ?;
106106 let predicate =
107- |child : & DomInstance | class_is_a ( & child. class , & class_name) . unwrap_or ( false ) ;
107+ |child : & DomInstance | class_is_a ( child. class , & class_name) . unwrap_or ( false ) ;
108108 if matches ! ( recursive, Some ( true ) ) {
109109 this. find_descendant ( predicate) . into_lua ( lua)
110110 } else {
@@ -113,7 +113,7 @@ pub fn add_methods<'lua, M: LuaUserDataMethods<'lua, Instance>>(m: &mut M) {
113113 } ,
114114 ) ;
115115 m. add_method ( "IsA" , |_, this, class_name : String | {
116- Ok ( class_is_a ( & this. class_name , class_name) . unwrap_or ( false ) )
116+ Ok ( class_is_a ( this. class_name , class_name) . unwrap_or ( false ) )
117117 } ) ;
118118 m. add_method (
119119 "IsAncestorOf" ,
@@ -230,7 +230,7 @@ fn instance_property_get<'lua>(
230230 return this. get_name ( ) . into_lua ( lua) ;
231231 }
232232
233- if let Some ( info) = find_property_info ( & this. class_name , & prop_name) {
233+ if let Some ( info) = find_property_info ( this. class_name , & prop_name) {
234234 if let Some ( prop) = this. get_property ( & prop_name) {
235235 if let DomValue :: Enum ( enum_value) = prop {
236236 let enum_name = info. enum_name . ok_or_else ( || {
@@ -275,7 +275,7 @@ fn instance_property_get<'lua>(
275275 } else if let Some ( inst) = this. find_child ( |inst| inst. name == prop_name) {
276276 Ok ( LuaValue :: UserData ( lua. create_userdata ( inst) ?) )
277277 } else if let Some ( getter) = InstanceRegistry :: find_property_getter ( lua, this, & prop_name) {
278- getter. call ( this. clone ( ) )
278+ getter. call ( * this)
279279 } else if let Some ( method) = InstanceRegistry :: find_method ( lua, this, & prop_name) {
280280 Ok ( LuaValue :: Function ( method) )
281281 } else {
@@ -321,13 +321,13 @@ fn instance_property_set<'lua>(
321321 }
322322 type Parent < ' lua > = Option < LuaUserDataRef < ' lua , Instance > > ;
323323 let parent = Parent :: from_lua ( prop_value, lua) ?;
324- this. set_parent ( parent. map ( |p| p . clone ( ) ) ) ;
324+ this. set_parent ( parent. map ( |p| * p ) ) ;
325325 return Ok ( ( ) ) ;
326326 }
327327 _ => { }
328328 }
329329
330- if let Some ( info) = find_property_info ( & this. class_name , & prop_name) {
330+ if let Some ( info) = find_property_info ( this. class_name , & prop_name) {
331331 if let Some ( enum_name) = info. enum_name {
332332 match LuaUserDataRef :: < EnumItem > :: from_lua ( prop_value, lua) {
333333 Ok ( given_enum) if given_enum. parent . desc . name == enum_name => {
@@ -354,7 +354,7 @@ fn instance_property_set<'lua>(
354354 ) ) )
355355 }
356356 } else if let Some ( setter) = InstanceRegistry :: find_property_setter ( lua, this, & prop_name) {
357- setter. call ( ( this. clone ( ) , prop_value) )
357+ setter. call ( ( * this, prop_value) )
358358 } else {
359359 Err ( LuaError :: RuntimeError ( format ! (
360360 "{prop_name} is not a valid member of {this}" ,
0 commit comments