Skip to content

Commit e49cd3d

Browse files
committed
refactor(frontmatter): Re-structure errors for easier span capturing
1 parent f55f790 commit e49cd3d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/cargo/util/frontmatter.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ impl<'s> ScriptSource<'s> {
5959
.char_indices()
6060
.find_map(|(i, c)| (c != FENCE_CHAR).then_some(i))
6161
.unwrap_or_else(|| input.eof_offset());
62+
let open_start = input.current_token_start();
63+
let fence_pattern = input.next_slice(fence_length);
64+
let open_end = input.current_token_start();
6265
match fence_length {
6366
0 => {
6467
return Ok(source);
@@ -71,9 +74,6 @@ impl<'s> ScriptSource<'s> {
7174
}
7275
_ => {}
7376
}
74-
let open_start = input.current_token_start();
75-
let fence_pattern = input.next_slice(fence_length);
76-
let open_end = input.current_token_start();
7777
source.open = Some(open_start..open_end);
7878
let Some(info_nl) = input.find_slice("\n") else {
7979
return Err(FrontmatterError::new(format!(

0 commit comments

Comments
 (0)