mirror of
https://github.com/rust-lang/cargo
synced 2024-09-17 23:01:51 +00:00
refactor: Clarify what Manifest::original means
I plan to add a true `original`
This commit is contained in:
parent
c8fa7096d4
commit
89f1cce439
|
@ -42,7 +42,7 @@ impl EitherManifest {
|
|||
#[derive(Clone, Debug)]
|
||||
pub struct Manifest {
|
||||
// alternate forms of manifests:
|
||||
original: Rc<TomlManifest>,
|
||||
resolved_toml: Rc<TomlManifest>,
|
||||
summary: Summary,
|
||||
|
||||
// this form of manifest:
|
||||
|
@ -389,7 +389,7 @@ compact_debug! {
|
|||
|
||||
impl Manifest {
|
||||
pub fn new(
|
||||
original: Rc<TomlManifest>,
|
||||
resolved_toml: Rc<TomlManifest>,
|
||||
summary: Summary,
|
||||
|
||||
default_kind: Option<CompileKind>,
|
||||
|
@ -416,7 +416,7 @@ impl Manifest {
|
|||
embedded: bool,
|
||||
) -> Manifest {
|
||||
Manifest {
|
||||
original,
|
||||
resolved_toml,
|
||||
summary,
|
||||
|
||||
default_kind,
|
||||
|
@ -500,8 +500,8 @@ impl Manifest {
|
|||
pub fn replace(&self) -> &[(PackageIdSpec, Dependency)] {
|
||||
&self.replace
|
||||
}
|
||||
pub fn original(&self) -> &TomlManifest {
|
||||
&self.original
|
||||
pub fn resolved_toml(&self) -> &TomlManifest {
|
||||
&self.resolved_toml
|
||||
}
|
||||
pub fn patch(&self) -> &HashMap<Url, Vec<Dependency>> {
|
||||
&self.patch
|
||||
|
|
|
@ -198,7 +198,7 @@ impl Package {
|
|||
}
|
||||
|
||||
pub fn to_registry_toml(&self, ws: &Workspace<'_>) -> CargoResult<String> {
|
||||
let manifest = prepare_for_publish(self.manifest().original(), ws, self.root())?;
|
||||
let manifest = prepare_for_publish(self.manifest().resolved_toml(), ws, self.root())?;
|
||||
let toml = toml::to_string_pretty(&manifest)?;
|
||||
Ok(format!("{}\n{}", MANIFEST_PREAMBLE, toml))
|
||||
}
|
||||
|
|
|
@ -1006,7 +1006,7 @@ impl<'gctx> Workspace<'gctx> {
|
|||
);
|
||||
self.gctx.shell().warn(&msg)
|
||||
};
|
||||
if manifest.original().has_profiles() {
|
||||
if manifest.resolved_toml().has_profiles() {
|
||||
emit_warning("profiles")?;
|
||||
}
|
||||
if !manifest.replace().is_empty() {
|
||||
|
|
|
@ -453,7 +453,8 @@ fn build_lock(ws: &Workspace<'_>, orig_pkg: &Package) -> CargoResult<String> {
|
|||
let orig_resolve = ops::load_pkg_lockfile(ws)?;
|
||||
|
||||
// Convert Package -> TomlManifest -> Manifest -> Package
|
||||
let toml_manifest = prepare_for_publish(orig_pkg.manifest().original(), ws, orig_pkg.root())?;
|
||||
let toml_manifest =
|
||||
prepare_for_publish(orig_pkg.manifest().resolved_toml(), ws, orig_pkg.root())?;
|
||||
let package_root = orig_pkg.root();
|
||||
let source_id = orig_pkg.package_id().source_id();
|
||||
let (manifest, _nested_paths) =
|
||||
|
|
|
@ -420,7 +420,7 @@ fn transmit(
|
|||
.map(|dep| dep.name.clone())
|
||||
.collect::<BTreeSet<String>>();
|
||||
|
||||
let string_features = match manifest.original().features() {
|
||||
let string_features = match manifest.resolved_toml().features() {
|
||||
Some(features) => features
|
||||
.iter()
|
||||
.map(|(feat, values)| {
|
||||
|
|
|
@ -363,7 +363,7 @@ fn cp_sources(
|
|||
let cksum = if dst.file_name() == Some(OsStr::new("Cargo.toml"))
|
||||
&& pkg.package_id().source_id().is_git()
|
||||
{
|
||||
let original_toml = toml::to_string_pretty(pkg.manifest().original())?;
|
||||
let original_toml = toml::to_string_pretty(pkg.manifest().resolved_toml())?;
|
||||
let contents = format!("{}\n{}", MANIFEST_PREAMBLE, original_toml);
|
||||
copy_and_checksum(
|
||||
&dst,
|
||||
|
|
Loading…
Reference in a new issue