Skip to content

Commit a6394bc

Browse files
committed
Remove unnecessary config argument to Features::add
The info was already present on `self`. Note that this uses a temporary variable to avoid a borrowck error from `slot`.
1 parent 3a86ecf commit a6394bc

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/cargo/core/features.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -413,20 +413,16 @@ impl Features {
413413
warnings: &mut Vec<String>,
414414
) -> CargoResult<Features> {
415415
let mut ret = Features::default();
416+
ret.nightly_features_allowed = config.nightly_features_allowed;
416417
for feature in features {
417-
ret.add(feature, config, warnings)?;
418+
ret.add(feature, warnings)?;
418419
ret.activated.push(feature.to_string());
419420
}
420-
ret.nightly_features_allowed = config.nightly_features_allowed;
421421
Ok(ret)
422422
}
423423

424-
fn add(
425-
&mut self,
426-
feature_name: &str,
427-
config: &Config,
428-
warnings: &mut Vec<String>,
429-
) -> CargoResult<()> {
424+
fn add(&mut self, feature_name: &str, warnings: &mut Vec<String>) -> CargoResult<()> {
425+
let nightly_features_allowed = self.nightly_features_allowed;
430426
let (slot, feature) = match self.status(feature_name) {
431427
Some(p) => p,
432428
None => bail!("unknown cargo feature `{}`", feature_name),
@@ -464,7 +460,7 @@ impl Features {
464460
);
465461
warnings.push(warning);
466462
}
467-
Status::Unstable if !config.nightly_features_allowed => bail!(
463+
Status::Unstable if !nightly_features_allowed => bail!(
468464
"the cargo feature `{}` requires a nightly version of \
469465
Cargo, but this is the `{}` channel\n\
470466
{}\n{}",

0 commit comments

Comments
 (0)