Skip to content

Commit

Permalink
Merge pull request #639 from serde-rs/map
Browse files Browse the repository at this point in the history
Simplify Map's PartialEq impl
  • Loading branch information
dtolnay authored Mar 27, 2020
2 parents 7fc2890 + 1583c16 commit 9c3b182
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions src/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,16 +229,7 @@ impl Clone for Map<String, Value> {
impl PartialEq for Map<String, Value> {
#[inline]
fn eq(&self, other: &Self) -> bool {
if cfg!(feature = "preserve_order") {
if self.len() != other.len() {
return false;
}

self.iter()
.all(|(key, value)| other.get(key).map_or(false, |v| *value == *v))
} else {
self.map.eq(&other.map)
}
self.map.eq(&other.map)
}
}

Expand Down

0 comments on commit 9c3b182

Please sign in to comment.