Skip to content

Commit

Permalink
Rollup merge of #61313 - Centril:simplify-set1-insert, r=varkor
Browse files Browse the repository at this point in the history
Simplify Set1::insert

r? @varkor
  • Loading branch information
oli-obk committed May 29, 2019
2 parents 1896756 + 3f3087b commit b742d7e
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/librustc/middle/resolve_lifetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,16 +170,11 @@ pub enum Set1<T> {

impl<T: PartialEq> Set1<T> {
pub fn insert(&mut self, value: T) {
if let Set1::Empty = *self {
*self = Set1::One(value);
return;
}
if let Set1::One(ref old) = *self {
if *old == value {
return;
}
}
*self = Set1::Many;
*self = match self {
Set1::Empty => Set1::One(value),
Set1::One(old) if *old == value => return,
_ => Set1::Many,
};
}
}

Expand Down

0 comments on commit b742d7e

Please sign in to comment.