Refactor if let chains to matches! macro

This commit is contained in:
Alik Aslanyan 2021-07-23 18:53:09 +04:00
parent 121f4b3b5c
commit c212a5c376
No known key found for this signature in database
GPG Key ID: 7FE6FD5D5BC4CCF6

View File

@ -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(_)
)
}
}