diff --git a/core/src/avm1/script_object.rs b/core/src/avm1/script_object.rs index 2c8127933..e9a831f2d 100644 --- a/core/src/avm1/script_object.rs +++ b/core/src/avm1/script_object.rs @@ -438,7 +438,7 @@ impl<'gc> TObject<'gc> for ScriptObject<'gc> { attributes: EnumSet, ) { self.0.write(gc_context).values.insert( - name.to_owned(), + name, Property::Virtual { get, set, @@ -458,7 +458,7 @@ impl<'gc> TObject<'gc> for ScriptObject<'gc> { attributes: EnumSet, ) { self.0.write(gc_context).values.insert( - name.to_owned(), + name, Property::Virtual { get, set, @@ -475,11 +475,10 @@ impl<'gc> TObject<'gc> for ScriptObject<'gc> { value: Value<'gc>, attributes: EnumSet, ) { - self.0.write(gc_context).values.insert( - name.to_string(), - Property::Stored { value, attributes }, - false, - ); + self.0 + .write(gc_context) + .values + .insert(name, Property::Stored { value, attributes }, false); } fn set_attributes( diff --git a/core/src/avm1/stage_object.rs b/core/src/avm1/stage_object.rs index e395a528a..28e5f07a1 100644 --- a/core/src/avm1/stage_object.rs +++ b/core/src/avm1/stage_object.rs @@ -598,7 +598,7 @@ impl<'gc> DisplayPropertyMap<'gc> { set: Option>, ) { let prop = DisplayProperty { get, set }; - self.0.insert(name.to_string(), prop, false); + self.0.insert(name, prop, false); } } diff --git a/core/src/property_map.rs b/core/src/property_map.rs index 5f9fe06ac..60dc443d9 100644 --- a/core/src/property_map.rs +++ b/core/src/property_map.rs @@ -76,8 +76,8 @@ impl PropertyMap { self.0.get_index(index).map(|(_, v)| v) } - pub fn insert(&mut self, key: String, value: V, case_sensitive: bool) -> Option { - match self.entry(&key, case_sensitive) { + pub fn insert(&mut self, key: &str, value: V, case_sensitive: bool) -> Option { + match self.entry(key, case_sensitive) { Entry::Occupied(entry) => Some(entry.insert(value)), Entry::Vacant(entry) => { entry.insert(value);