Skip to content

Commit 278cfee

Browse files
style(clippy): use strip_prefix instead of manual prefix stripping in sanitize.rs (#661)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 0585e96 commit 278cfee

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/sanitize.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,12 @@ pub(crate) fn neutralize_pipeline_commands(input: &str) -> String {
149149
while let Some(pos) = rest.find("##") {
150150
result.push_str(&rest[..pos]);
151151
let after = &rest[pos + 2..];
152-
if after.starts_with("vso[") {
152+
if let Some(stripped) = after.strip_prefix("vso[") {
153153
result.push_str("`##vso[`");
154-
rest = &after[4..];
155-
} else if after.starts_with('[') {
154+
rest = stripped;
155+
} else if let Some(stripped) = after.strip_prefix('[') {
156156
result.push_str("`##[`");
157-
rest = &after[1..];
157+
rest = stripped;
158158
} else {
159159
// Harmless "##" (e.g. markdown heading)
160160
result.push_str("##");

0 commit comments

Comments
 (0)