mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
Refactor if let chains to matches! macro
This commit is contained in:
parent
121f4b3b5c
commit
c212a5c376
@ -299,34 +299,22 @@ pub enum ConflictReason {
|
|||||||
|
|
||||||
impl ConflictReason {
|
impl ConflictReason {
|
||||||
pub fn is_links(&self) -> bool {
|
pub fn is_links(&self) -> bool {
|
||||||
if let ConflictReason::Links(_) = *self {
|
matches!(self, ConflictReason::Links(_))
|
||||||
return true;
|
|
||||||
}
|
|
||||||
false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_missing_features(&self) -> bool {
|
pub fn is_missing_features(&self) -> bool {
|
||||||
if let ConflictReason::MissingFeatures(_) = *self {
|
matches!(self, ConflictReason::MissingFeatures(_))
|
||||||
return true;
|
|
||||||
}
|
|
||||||
false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_required_dependency_as_features(&self) -> bool {
|
pub fn is_required_dependency_as_features(&self) -> bool {
|
||||||
if let ConflictReason::RequiredDependencyAsFeature(_) = *self {
|
matches!(self, ConflictReason::RequiredDependencyAsFeature(_))
|
||||||
return true;
|
|
||||||
}
|
|
||||||
false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_public_dependency(&self) -> bool {
|
pub fn is_public_dependency(&self) -> bool {
|
||||||
if let ConflictReason::PublicDependency(_) = *self {
|
matches!(
|
||||||
return true;
|
self,
|
||||||
}
|
ConflictReason::PublicDependency(_) | ConflictReason::PubliclyExports(_)
|
||||||
if let ConflictReason::PubliclyExports(_) = *self {
|
)
|
||||||
return true;
|
|
||||||
}
|
|
||||||
false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user