Skip to content

Commit 0048f2f

Browse files
committed
refactor(core): Reuse TomlManifest for TomlProfiles
1 parent 8152bfb commit 0048f2f

File tree

3 files changed

+4
-15
lines changed

3 files changed

+4
-15
lines changed

src/cargo/core/compiler/standard_lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ pub fn resolve_std<'gctx>(
111111
/*replace*/ Vec::new(),
112112
patch,
113113
ws_config,
114-
/*profiles*/ None,
115114
crate::core::Features::default(),
116115
None,
117116
);

src/cargo/core/manifest.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ pub struct Manifest {
5858
include: Vec<String>,
5959
metadata: ManifestMetadata,
6060
custom_metadata: Option<toml::Value>,
61-
profiles: Option<TomlProfiles>,
6261
publish: Option<Vec<String>>,
6362
replace: Vec<(PackageIdSpec, Dependency)>,
6463
patch: HashMap<Url, Vec<Dependency>>,
@@ -98,7 +97,6 @@ pub struct VirtualManifest {
9897
replace: Vec<(PackageIdSpec, Dependency)>,
9998
patch: HashMap<Url, Vec<Dependency>>,
10099
workspace: WorkspaceConfig,
101-
profiles: Option<TomlProfiles>,
102100
warnings: Warnings,
103101
features: Features,
104102
resolve_behavior: Option<ResolveBehavior>,
@@ -416,7 +414,6 @@ impl Manifest {
416414
links: Option<String>,
417415
metadata: ManifestMetadata,
418416
custom_metadata: Option<toml::Value>,
419-
profiles: Option<TomlProfiles>,
420417
publish: Option<Vec<String>>,
421418
replace: Vec<(PackageIdSpec, Dependency)>,
422419
patch: HashMap<Url, Vec<Dependency>>,
@@ -447,7 +444,6 @@ impl Manifest {
447444
links,
448445
metadata,
449446
custom_metadata,
450-
profiles,
451447
publish,
452448
replace,
453449
patch,
@@ -528,7 +524,7 @@ impl Manifest {
528524
&self.warnings
529525
}
530526
pub fn profiles(&self) -> Option<&TomlProfiles> {
531-
self.profiles.as_ref()
527+
self.resolved_toml.profile.as_ref()
532528
}
533529
pub fn publish(&self) -> &Option<Vec<String>> {
534530
&self.publish
@@ -643,7 +639,6 @@ impl VirtualManifest {
643639
replace: Vec<(PackageIdSpec, Dependency)>,
644640
patch: HashMap<Url, Vec<Dependency>>,
645641
workspace: WorkspaceConfig,
646-
profiles: Option<TomlProfiles>,
647642
features: Features,
648643
resolve_behavior: Option<ResolveBehavior>,
649644
) -> VirtualManifest {
@@ -655,7 +650,6 @@ impl VirtualManifest {
655650
replace,
656651
patch,
657652
workspace,
658-
profiles,
659653
warnings: Warnings::new(),
660654
features,
661655
resolve_behavior,
@@ -692,7 +686,7 @@ impl VirtualManifest {
692686
}
693687

694688
pub fn profiles(&self) -> Option<&TomlProfiles> {
695-
self.profiles.as_ref()
689+
self.resolved_toml.profile.as_ref()
696690
}
697691

698692
pub fn warnings_mut(&mut self) -> &mut Warnings {

src/cargo/util/toml/mod.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,8 +1108,7 @@ pub fn to_real_manifest(
11081108
.as_ref()
11091109
.map(|_| manifest::InheritableField::Value(include.clone()));
11101110

1111-
let profiles = original_toml.profile.clone();
1112-
if let Some(profiles) = &profiles {
1111+
if let Some(profiles) = &original_toml.profile {
11131112
let cli_unstable = gctx.cli_unstable();
11141113
validate_profiles(profiles, cli_unstable, &features, &mut warnings)?;
11151114
}
@@ -1211,7 +1210,6 @@ pub fn to_real_manifest(
12111210
package.links.clone(),
12121211
metadata,
12131212
custom_metadata,
1214-
profiles,
12151213
publish,
12161214
replace,
12171215
patch,
@@ -1328,8 +1326,7 @@ fn to_virtual_manifest(
13281326
patch(&original_toml, &mut manifest_ctx)?,
13291327
)
13301328
};
1331-
let profiles = original_toml.profile.clone();
1332-
if let Some(profiles) = &profiles {
1329+
if let Some(profiles) = &original_toml.profile {
13331330
validate_profiles(profiles, gctx.cli_unstable(), &features, &mut warnings)?;
13341331
}
13351332
let resolve_behavior = original_toml
@@ -1374,7 +1371,6 @@ fn to_virtual_manifest(
13741371
replace,
13751372
patch,
13761373
workspace_config,
1377-
profiles,
13781374
features,
13791375
resolve_behavior,
13801376
);

0 commit comments

Comments
 (0)