Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor if let chains to matches! macro #9721

Merged
merged 1 commit into from
Jul 23, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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