Skip to content

Commit

Permalink
Simplify Role's Ord impl
Browse files Browse the repository at this point in the history
  • Loading branch information
Austin Hellyer committed Dec 28, 2016
1 parent 5b275fc commit 6a887b2
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/model/guild.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1150,18 +1150,10 @@ impl Eq for Role {}

impl Ord for Role {
fn cmp(&self, other: &Role) -> Ordering {
if self.position > other.position {
Ordering::Greater
} else if self.position == other.position {
if self.id > other.id {
Ordering::Greater
} else if self.id == other.id {
Ordering::Equal
} else {
Ordering::Less
}
if self.position == other.position {
self.id.cmp(&other.id)
} else {
Ordering::Less
self.position.cmp(&other.position)
}
}
}
Expand Down

0 comments on commit 6a887b2

Please sign in to comment.