We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
workspace
1 parent d5ad2d2 commit dcd0c49Copy full SHA for dcd0c49
src/cargo/ops/cargo_new.rs
@@ -1022,7 +1022,7 @@ fn update_manifest_with_new_member(
1022
}
1023
1024
1025
- } else {
+ } else if workspace_document.contains_key("workspace") {
1026
let ws = workspace_document["workspace"]
1027
.as_table_mut()
1028
.with_context(|| format!("[workspace] is not a table"))?;
@@ -1050,6 +1050,11 @@ fn update_manifest_with_new_member(
1050
1051
1052
ws.insert("members", toml_edit::value(array));
1053
+ } else {
1054
+ let mut array = Array::new();
1055
+ array.push(relpath);
1056
+ array.decor_mut().set_suffix("\n");
1057
+ workspace_document["workspace"]["members"] = toml_edit::value(array);
1058
1059
1060
paths::write(&root_manifest_path, workspace_document.to_string())
0 commit comments