From c212a5c376c9fa14fb16758ec44dae48d6d701c6 Mon Sep 17 00:00:00 2001 From: Alik Aslanyan Date: Fri, 23 Jul 2021 18:53:09 +0400 Subject: [PATCH] Refactor if let chains to matches! macro --- src/cargo/core/resolver/types.rs | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/src/cargo/core/resolver/types.rs b/src/cargo/core/resolver/types.rs index 6a7e3a84735..655a9524ddd 100644 --- a/src/cargo/core/resolver/types.rs +++ b/src/cargo/core/resolver/types.rs @@ -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(_) + ) } }