Skip to content

Commit dffd0fd

Browse files
committed
refactor(embedded): Move workspace to normalization
1 parent 3582b78 commit dffd0fd

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/cargo/util/toml/embedded.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,6 @@ fn expand_manifest_(manifest: &str, path: &std::path::Path) -> CargoResult<toml:
8484
}
8585
}
8686

87-
// Prevent looking for a workspace by `read_manifest_from_str`
88-
manifest.insert("workspace".to_owned(), toml::Table::new().into());
89-
9087
if let Some(package) = manifest.get("package").and_then(|v| v.as_table()) {
9188
for key in ["workspace", "build", "links"]
9289
.iter()
@@ -539,8 +536,6 @@ fn main() {}
539536
name = "test-"
540537
path = "/home/me/test.rs"
541538
542-
[workspace]
543-
544539
"#]]
545540
);
546541
}
@@ -564,8 +559,6 @@ path = [..]
564559
[dependencies]
565560
time = "0.1.25"
566561
567-
[workspace]
568-
569562
"#]]
570563
);
571564
}

src/cargo/util/toml/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,10 @@ fn normalize_toml(
308308
build_dependencies2: None,
309309
target: None,
310310
lints: None,
311-
workspace: original_toml.workspace.clone(),
311+
workspace: original_toml.workspace.clone().or_else(|| {
312+
// Prevent looking for a workspace by `read_manifest_from_str`
313+
is_embedded.then(manifest::TomlWorkspace::default)
314+
}),
312315
profile: original_toml.profile.clone(),
313316
patch: normalize_patch(
314317
gctx,

0 commit comments

Comments
 (0)