Skip to content

Commit 1b25322

Browse files
committed
fix(frontmatter): Be more direct in trailing close character error
For comparison, the rustc error is: > error: extra characters after frontmatter close are not allowed > --> $DIR/extra-after-end.rs:2:1 > | > LL | ---cargo > | ^^^^^^^^
1 parent 60bcd83 commit 1b25322

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/cargo/util/frontmatter.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ impl<'s> ScriptSource<'s> {
132132
if !after_closing_fence.is_empty() {
133133
// extra characters beyond the original fence pattern, even if they are extra `-`
134134
return Err(FrontmatterError::new(
135-
format!("trailing characters found after frontmatter close"),
135+
format!("unexpected characters after frontmatter close"),
136136
close_end..content_start,
137137
));
138138
}
@@ -584,7 +584,7 @@ content: "\nfn main() {}\n"
584584
fn main() {}
585585
"#,
586586
),
587-
str!["trailing characters found after frontmatter close"],
587+
str!["unexpected characters after frontmatter close"],
588588
);
589589
}
590590

@@ -621,7 +621,7 @@ time="0.1.25"
621621
fn main() {}
622622
"#,
623623
),
624-
str!["trailing characters found after frontmatter close"],
624+
str!["unexpected characters after frontmatter close"],
625625
);
626626
}
627627

tests/testsuite/script/rustc_fixtures/extra-after-end.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[ERROR] trailing characters found after frontmatter close
1+
[ERROR] unexpected characters after frontmatter close
22
--> script:2:4
33
|
44
2 | ---cargo

tests/testsuite/script/rustc_fixtures/mismatch-1.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[ERROR] trailing characters found after frontmatter close
1+
[ERROR] unexpected characters after frontmatter close
22
--> script:3:4
33
|
44
3 | ----

0 commit comments

Comments
 (0)