Skip to content

Commit e6976ec

Browse files
committed
Auto merge of #9721 - In-line:refactor-if-let-chains, r=ehuss
Refactor if let chains to matches! macro
2 parents 37d9fdb + c212a5c commit e6976ec

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

src/cargo/core/resolver/types.rs

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -299,34 +299,22 @@ pub enum ConflictReason {
299299

300300
impl ConflictReason {
301301
pub fn is_links(&self) -> bool {
302-
if let ConflictReason::Links(_) = *self {
303-
return true;
304-
}
305-
false
302+
matches!(self, ConflictReason::Links(_))
306303
}
307304

308305
pub fn is_missing_features(&self) -> bool {
309-
if let ConflictReason::MissingFeatures(_) = *self {
310-
return true;
311-
}
312-
false
306+
matches!(self, ConflictReason::MissingFeatures(_))
313307
}
314308

315309
pub fn is_required_dependency_as_features(&self) -> bool {
316-
if let ConflictReason::RequiredDependencyAsFeature(_) = *self {
317-
return true;
318-
}
319-
false
310+
matches!(self, ConflictReason::RequiredDependencyAsFeature(_))
320311
}
321312

322313
pub fn is_public_dependency(&self) -> bool {
323-
if let ConflictReason::PublicDependency(_) = *self {
324-
return true;
325-
}
326-
if let ConflictReason::PubliclyExports(_) = *self {
327-
return true;
328-
}
329-
false
314+
matches!(
315+
self,
316+
ConflictReason::PublicDependency(_) | ConflictReason::PubliclyExports(_)
317+
)
330318
}
331319
}
332320

0 commit comments

Comments
 (0)