Skip to content

Commit c1248ad

Browse files
committed
fix(toml): Don't error on leading whitespace in infostring
According to the [RFC](https://rust-lang.github.io/rfcs/3503-frontmatter.html): > Opens with 3+ dashes followed by 0+ whitespace, > an optional term (one or more characters excluding whitespace and commas), > 0+ whitespace, and a newline
1 parent 8918634 commit c1248ad

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/cargo/util/toml/embedded.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ fn split_source(input: &str) -> CargoResult<Source<'_>> {
245245
_ => source.content.split_at(fence_end),
246246
};
247247
let (info, content) = rest.split_once("\n").unwrap_or((rest, ""));
248-
let info = info.trim_end();
248+
let info = info.trim();
249249
if !info.is_empty() {
250250
source.info = Some(info);
251251
}
@@ -378,7 +378,7 @@ fn main() {}
378378
"#,
379379
str![[r#"
380380
shebang: None
381-
info: " cargo"
381+
info: "cargo"
382382
frontmatter: "[dependencies]\ntime=\"0.1.25\"\n"
383383
content: "fn main() {}\n"
384384

0 commit comments

Comments
 (0)