Skip to content

Commit 8918634

Browse files
committed
fix(toml): Don't error on infostrings with trailing whitespace
1 parent 51db441 commit 8918634

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/cargo/util/toml/embedded.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,9 @@ 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();
248249
if !info.is_empty() {
249-
source.info = Some(info.trim_end());
250+
source.info = Some(info);
250251
}
251252
source.content = content;
252253

@@ -411,7 +412,7 @@ content: "fn main() {}\n"
411412
"#!/usr/bin/env cargo\r\n---\r\n[dependencies]\r\ntime=\"0.1.25\"\r\n---\r\nfn main() {}",
412413
str![[r##"
413414
shebang: "#!/usr/bin/env cargo\r\n"
414-
info: ""
415+
info: None
415416
frontmatter: "[dependencies]\r\ntime=\"0.1.25\"\r\n"
416417
content: "fn main() {}"
417418

0 commit comments

Comments
 (0)