let has_lib;
if let Some(target) = clean_lib(
- features,
manifest.lib.as_ref(),
package_root,
package_name,
)?);
targets.extend(clean_examples(
- features,
manifest.example.as_ref(),
package_root,
edition,
)?);
targets.extend(clean_tests(
- features,
manifest.test.as_ref(),
package_root,
edition,
)?);
targets.extend(clean_benches(
- features,
manifest.bench.as_ref(),
package_root,
edition,
}
fn clean_lib(
- features: &Features,
toml_lib: Option<&TomlLibTarget>,
package_root: &Path,
package_name: &str,
};
let mut target = Target::lib_target(&lib.name(), crate_types, path, edition);
- configure(features, lib, &mut target)?;
+ configure(lib, &mut target)?;
Ok(Some(target))
}
edition,
);
- configure(features, bin, &mut target)?;
+ configure(bin, &mut target)?;
result.push(target);
}
return Ok(result);
}
fn clean_examples(
- features: &Features,
toml_examples: Option<&Vec<TomlExampleTarget>>,
package_root: &Path,
edition: Edition,
toml.required_features.clone(),
edition,
);
- configure(features, &toml, &mut target)?;
+ configure(&toml, &mut target)?;
result.push(target);
}
}
fn clean_tests(
- features: &Features,
toml_tests: Option<&Vec<TomlTestTarget>>,
package_root: &Path,
edition: Edition,
for (path, toml) in targets {
let mut target =
Target::test_target(&toml.name(), path, toml.required_features.clone(), edition);
- configure(features, &toml, &mut target)?;
+ configure(&toml, &mut target)?;
result.push(target);
}
Ok(result)
}
fn clean_benches(
- features: &Features,
toml_benches: Option<&Vec<TomlBenchTarget>>,
package_root: &Path,
edition: Edition,
for (path, toml) in targets {
let mut target =
Target::bench_target(&toml.name(), path, toml.required_features.clone(), edition);
- configure(features, &toml, &mut target)?;
+ configure(&toml, &mut target)?;
result.push(target);
}
Ok(())
}
-fn configure(features: &Features, toml: &TomlTarget, target: &mut Target) -> CargoResult<()> {
+fn configure(toml: &TomlTarget, target: &mut Target) -> CargoResult<()> {
let t2 = target.clone();
target
.set_tested(toml.test.unwrap_or_else(|| t2.tested()))
(Some(false), _) | (_, Some(false)) => false,
});
if let Some(edition) = toml.edition.clone() {
- features
- .require(Feature::edition())
- .with_context(|| "editions are unstable")?;
target.set_edition(
edition
.parse()