Skip to content

Commit 45c2ff8

Browse files
committed
refactor(toml): Remove references to multiple fence chars
1 parent 8c88f23 commit 45c2ff8

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/cargo/util/toml/embedded.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,21 +224,20 @@ fn split_source(input: &str) -> CargoResult<Source<'_>> {
224224
source.content = content;
225225
}
226226

227-
// Experiment: let us try which char works better
228-
let fence_char = '-';
227+
const FENCE_CHAR: char = '-';
229228

230229
let fence_end = source
231230
.content
232231
.char_indices()
233-
.find_map(|(i, c)| (c != fence_char).then_some(i))
232+
.find_map(|(i, c)| (c != FENCE_CHAR).then_some(i))
234233
.unwrap_or(source.content.len());
235234
let (fence_pattern, rest) = match fence_end {
236235
0 => {
237236
return Ok(source);
238237
}
239238
1 | 2 => {
240239
anyhow::bail!(
241-
"found {fence_end} `{fence_char}` in rust frontmatter, expected at least 3"
240+
"found {fence_end} `{FENCE_CHAR}` in rust frontmatter, expected at least 3"
242241
)
243242
}
244243
_ => source.content.split_at(fence_end),

0 commit comments

Comments
 (0)