Skip to content

Commit e46f916

Browse files
committed
fix(embedded): Make infostring optional
This is to allow us to experiment with how things change if there is no infostring.
1 parent 7e5dd71 commit e46f916

File tree

1 file changed

+34
-4
lines changed

1 file changed

+34
-4
lines changed

src/cargo/util/toml/embedded.rs

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ pub(super) fn expand_manifest(
1818
let source = split_source(content)?;
1919
if let Some(frontmatter) = source.frontmatter {
2020
match source.info {
21-
Some("cargo") => {}
22-
None => {
23-
anyhow::bail!("frontmatter is missing an infostring; specify `cargo` for embedding a manifest");
24-
}
21+
Some("cargo") | None => {}
2522
Some(other) => {
2623
if let Some(remainder) = other.strip_prefix("cargo,") {
2724
anyhow::bail!("cargo does not support frontmatter infostring attributes like `{remainder}` at this time")
@@ -328,6 +325,39 @@ strip = true
328325
time="0.1.25"
329326
```
330327
fn main() {}
328+
"#),
329+
);
330+
}
331+
332+
#[test]
333+
fn test_no_infostring() {
334+
snapbox::assert_matches(
335+
r#"[[bin]]
336+
name = "test-"
337+
path = [..]
338+
339+
[dependencies]
340+
time = "0.1.25"
341+
342+
[package]
343+
autobenches = false
344+
autobins = false
345+
autoexamples = false
346+
autotests = false
347+
build = false
348+
edition = "2021"
349+
name = "test-"
350+
351+
[profile.release]
352+
strip = true
353+
354+
[workspace]
355+
"#,
356+
si!(r#"```
357+
[dependencies]
358+
time="0.1.25"
359+
```
360+
fn main() {}
331361
"#),
332362
);
333363
}

0 commit comments

Comments
 (0)