Skip to content

Commit 05621c1

Browse files
runningcodeclaude
andcommitted
fix: address clippy warnings in GitHub Actions PR detection
- Use iterator instead of needless range loop - Use to_owned() instead of to_string() on &str 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 6d4ef6c commit 05621c1

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/utils/vcs.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -571,8 +571,8 @@ fn extract_pr_head_sha_from_event(json_content: &str) -> Option<String> {
571571
for (i, line) in lines.iter().enumerate() {
572572
if line.contains("\"head\":") {
573573
// Look for "sha" in the next few lines after finding "head"
574-
for j in i..std::cmp::min(i + 10, lines.len()) {
575-
if let Some(sha) = extract_sha_from_line(lines[j]) {
574+
for line in lines.iter().take(std::cmp::min(i + 10, lines.len())).skip(i) {
575+
if let Some(sha) = extract_sha_from_line(line) {
576576
return Some(sha);
577577
}
578578
}
@@ -587,11 +587,11 @@ fn extract_sha_from_line(line: &str) -> Option<String> {
587587
if line.contains("\"sha\":") {
588588
// Try with space first: "sha": "
589589
if let Some(sha_part) = line.split("\"sha\": \"").nth(1) {
590-
return sha_part.split('"').next().map(|sha| sha.to_string());
590+
return sha_part.split('"').next().map(|sha| sha.to_owned());
591591
}
592592
// Try without space: "sha":"
593593
if let Some(sha_part) = line.split("\"sha\":\"").nth(1) {
594-
return sha_part.split('"').next().map(|sha| sha.to_string());
594+
return sha_part.split('"').next().map(|sha| sha.to_owned());
595595
}
596596
}
597597
None

0 commit comments

Comments
 (0)