Skip to content

Commit

Permalink
Auto merge of #9721 - In-line:refactor-if-let-chains, r=ehuss
Browse files Browse the repository at this point in the history
Refactor if let chains to matches! macro
  • Loading branch information
bors committed Jul 23, 2021
2 parents 37d9fdb + c212a5c commit e6976ec
Showing 1 changed file with 7 additions and 19 deletions.
26 changes: 7 additions & 19 deletions src/cargo/core/resolver/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,34 +299,22 @@ pub enum ConflictReason {

impl ConflictReason {
pub fn is_links(&self) -> bool {
if let ConflictReason::Links(_) = *self {
return true;
}
false
matches!(self, ConflictReason::Links(_))
}

pub fn is_missing_features(&self) -> bool {
if let ConflictReason::MissingFeatures(_) = *self {
return true;
}
false
matches!(self, ConflictReason::MissingFeatures(_))
}

pub fn is_required_dependency_as_features(&self) -> bool {
if let ConflictReason::RequiredDependencyAsFeature(_) = *self {
return true;
}
false
matches!(self, ConflictReason::RequiredDependencyAsFeature(_))
}

pub fn is_public_dependency(&self) -> bool {
if let ConflictReason::PublicDependency(_) = *self {
return true;
}
if let ConflictReason::PubliclyExports(_) = *self {
return true;
}
false
matches!(
self,
ConflictReason::PublicDependency(_) | ConflictReason::PubliclyExports(_)
)
}
}

Expand Down

0 comments on commit e6976ec

Please sign in to comment.