diff --git a/core/src/avm1/script_object.rs b/core/src/avm1/script_object.rs index 5a1d1ca56..2c8127933 100644 --- a/core/src/avm1/script_object.rs +++ b/core/src/avm1/script_object.rs @@ -159,12 +159,7 @@ impl<'gc> ScriptObject<'gc> { native_value: Option>, is_enumerable: bool, ) { - match self - .0 - .write(gc_context) - .values - .entry(name.to_string(), false) - { + match self.0.write(gc_context).values.entry(name, false) { Entry::Occupied(mut entry) => { if let Property::Stored { value, .. } = entry.get_mut() { match native_value { @@ -267,7 +262,7 @@ impl<'gc> ScriptObject<'gc> { .0 .write(context.gc_context) .values - .entry(name.to_owned(), activation.is_case_sensitive()) + .entry(name, activation.is_case_sensitive()) { Entry::Occupied(mut entry) => entry.get_mut().set(value.clone()), Entry::Vacant(entry) => { diff --git a/core/src/property_map.rs b/core/src/property_map.rs index 12124c0d5..b20a7f726 100644 --- a/core/src/property_map.rs +++ b/core/src/property_map.rs @@ -26,7 +26,7 @@ impl PropertyMap { } } - pub fn entry(&mut self, key: String, case_sensitive: bool) -> Entry { + pub fn entry(&mut self, key: &str, case_sensitive: bool) -> Entry { if case_sensitive { match self.0.get_full_mut(&CaseSensitiveStr(&key)) { Some((index, _, _)) => Entry::Occupied(OccupiedEntry { @@ -35,7 +35,7 @@ impl PropertyMap { }), None => Entry::Vacant(VacantEntry { map: &mut self.0, - key, + key: key.to_string(), }), } } else { @@ -46,7 +46,7 @@ impl PropertyMap { }), None => Entry::Vacant(VacantEntry { map: &mut self.0, - key, + key: key.to_string(), }), } } @@ -77,7 +77,7 @@ impl PropertyMap { } pub fn insert(&mut self, key: String, value: V, case_sensitive: bool) -> Option { - match self.entry(key, case_sensitive) { + match self.entry(&key, case_sensitive) { Entry::Occupied(entry) => Some(entry.insert(value)), Entry::Vacant(entry) => { entry.insert(value);