Skip to content

Commit

Permalink
Use then_some in try_join
Browse files Browse the repository at this point in the history
  • Loading branch information
smoelius committed Jul 14, 2023
1 parent dbd9a0b commit d475a76
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions clippy_utils/src/ty/type_certainty/certainty.rs
Expand Up @@ -41,13 +41,7 @@ impl Meet for Option<DefId> {
impl TryJoin for Option<DefId> {
fn try_join(self, other: Self) -> Option<Self> {
match (self, other) {
(Some(lhs), Some(rhs)) => {
if lhs == rhs {
Some(Some(lhs))
} else {
None
}
},
(Some(lhs), Some(rhs)) => (lhs == rhs).then_some(Some(lhs)),
(Some(def_id), _) | (_, Some(def_id)) => Some(Some(def_id)),
(None, None) => Some(None),
}
Expand Down

0 comments on commit d475a76

Please sign in to comment.