Skip to content

Commit

Permalink
Simplify Map's PartialEq impl
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Mar 27, 2020
1 parent 7fc2890 commit 1583c16
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 1583c16

Please sign in to comment.