core: Made PropertyMap::entry take &str instead of String. We often don't need ownership here.
This commit is contained in:
parent
b5c06be8a2
commit
f4921fad45
|
@ -159,12 +159,7 @@ impl<'gc> ScriptObject<'gc> {
|
||||||
native_value: Option<Value<'gc>>,
|
native_value: Option<Value<'gc>>,
|
||||||
is_enumerable: bool,
|
is_enumerable: bool,
|
||||||
) {
|
) {
|
||||||
match self
|
match self.0.write(gc_context).values.entry(name, false) {
|
||||||
.0
|
|
||||||
.write(gc_context)
|
|
||||||
.values
|
|
||||||
.entry(name.to_string(), false)
|
|
||||||
{
|
|
||||||
Entry::Occupied(mut entry) => {
|
Entry::Occupied(mut entry) => {
|
||||||
if let Property::Stored { value, .. } = entry.get_mut() {
|
if let Property::Stored { value, .. } = entry.get_mut() {
|
||||||
match native_value {
|
match native_value {
|
||||||
|
@ -267,7 +262,7 @@ impl<'gc> ScriptObject<'gc> {
|
||||||
.0
|
.0
|
||||||
.write(context.gc_context)
|
.write(context.gc_context)
|
||||||
.values
|
.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::Occupied(mut entry) => entry.get_mut().set(value.clone()),
|
||||||
Entry::Vacant(entry) => {
|
Entry::Vacant(entry) => {
|
||||||
|
|
|
@ -26,7 +26,7 @@ impl<V> PropertyMap<V> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn entry(&mut self, key: String, case_sensitive: bool) -> Entry<V> {
|
pub fn entry(&mut self, key: &str, case_sensitive: bool) -> Entry<V> {
|
||||||
if case_sensitive {
|
if case_sensitive {
|
||||||
match self.0.get_full_mut(&CaseSensitiveStr(&key)) {
|
match self.0.get_full_mut(&CaseSensitiveStr(&key)) {
|
||||||
Some((index, _, _)) => Entry::Occupied(OccupiedEntry {
|
Some((index, _, _)) => Entry::Occupied(OccupiedEntry {
|
||||||
|
@ -35,7 +35,7 @@ impl<V> PropertyMap<V> {
|
||||||
}),
|
}),
|
||||||
None => Entry::Vacant(VacantEntry {
|
None => Entry::Vacant(VacantEntry {
|
||||||
map: &mut self.0,
|
map: &mut self.0,
|
||||||
key,
|
key: key.to_string(),
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -46,7 +46,7 @@ impl<V> PropertyMap<V> {
|
||||||
}),
|
}),
|
||||||
None => Entry::Vacant(VacantEntry {
|
None => Entry::Vacant(VacantEntry {
|
||||||
map: &mut self.0,
|
map: &mut self.0,
|
||||||
key,
|
key: key.to_string(),
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ impl<V> PropertyMap<V> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn insert(&mut self, key: String, value: V, case_sensitive: bool) -> Option<V> {
|
pub fn insert(&mut self, key: String, value: V, case_sensitive: bool) -> Option<V> {
|
||||||
match self.entry(key, case_sensitive) {
|
match self.entry(&key, case_sensitive) {
|
||||||
Entry::Occupied(entry) => Some(entry.insert(value)),
|
Entry::Occupied(entry) => Some(entry.insert(value)),
|
||||||
Entry::Vacant(entry) => {
|
Entry::Vacant(entry) => {
|
||||||
entry.insert(value);
|
entry.insert(value);
|
||||||
|
|
Loading…
Reference in New Issue