Skip to content

Commit 9837239

Browse files
author
Jon Gjengset
committed
Move from match guard to if
1 parent 6be9eec commit 9837239

File tree

1 file changed

+10
-18
lines changed

1 file changed

+10
-18
lines changed

src/cargo/core/features.rs

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -475,25 +475,17 @@ impl Features {
475475
SEE_CHANNELS,
476476
see_docs()
477477
),
478-
Status::Unstable
479-
if !config
480-
.cli_unstable()
481-
.allow_features
482-
.as_ref()
483-
.map(|f| f.contains(feature_name))
484-
.unwrap_or(true) =>
485-
{
486-
bail!(
487-
"the feature `{}` is not in the list of allowed features: {:?}",
488-
feature_name,
489-
config
490-
.cli_unstable()
491-
.allow_features
492-
.as_ref()
493-
.expect("!unwrap_or(true) == false")
494-
)
478+
Status::Unstable => {
479+
if let Some(allow) = &config.cli_unstable().allow_features {
480+
if !allow.contains(feature_name) {
481+
bail!(
482+
"the feature `{}` is not in the list of allowed features: {:?}",
483+
feature_name,
484+
allow,
485+
);
486+
}
487+
}
495488
}
496-
Status::Unstable => {}
497489
Status::Removed => bail!(
498490
"the cargo feature `{}` has been removed\n\
499491
Remove the feature from Cargo.toml to remove this error.\n\

0 commit comments

Comments
 (0)