Skip to content

Commit

Permalink
Change if-else to match
Browse files Browse the repository at this point in the history
  • Loading branch information
raskad committed Aug 23, 2021
1 parent 0486f56 commit dd02a18
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions boa/src/object/internal_methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -902,12 +902,10 @@ impl GcObject {
// 4. For each element key of ownKeys, do
for key in own_keys {
// a. If Type(key) is String, then
let key_str = if let PropertyKey::Index(index) = &key {
Some(index.to_string().into())
} else if let PropertyKey::String(key_str) = &key {
Some(key_str.clone())
} else {
None
let key_str = match &key {
PropertyKey::String(s) => Some(s.clone()),
PropertyKey::Index(i) => Some(i.to_string().into()),
_ => None
};

if let Some(key_str) = key_str {
Expand Down

0 comments on commit dd02a18

Please sign in to comment.