Skip to content

Commit 544013e

Browse files
committed
refactor(embedded): Clarify the parser
1 parent e148c3d commit 544013e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/cargo/util/toml/embedded.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,17 +148,17 @@ impl<'s> ScriptSource<'s> {
148148

149149
const FENCE_CHAR: char = '-';
150150

151-
let mut trimmed_content = source.content;
152-
while !trimmed_content.is_empty() {
153-
let c = trimmed_content;
151+
let mut rest = source.content;
152+
while !rest.is_empty() {
153+
let c = rest;
154154
let c = c.trim_start_matches([' ', '\t']);
155155
let c = c.trim_start_matches(['\r', '\n']);
156-
if c == trimmed_content {
156+
if c == rest {
157157
break;
158158
}
159-
trimmed_content = c;
159+
rest = c;
160160
}
161-
let fence_end = trimmed_content
161+
let fence_end = rest
162162
.char_indices()
163163
.find_map(|(i, c)| (c != FENCE_CHAR).then_some(i))
164164
.unwrap_or(source.content.len());
@@ -171,7 +171,7 @@ impl<'s> ScriptSource<'s> {
171171
"found {fence_end} `{FENCE_CHAR}` in rust frontmatter, expected at least 3"
172172
)
173173
}
174-
_ => trimmed_content.split_at(fence_end),
174+
_ => rest.split_at(fence_end),
175175
};
176176
let (info, content) = rest.split_once("\n").unwrap_or((rest, ""));
177177
let info = info.trim();

0 commit comments

Comments
 (0)