From 0784fd95bcca54c01285097eddea01020203e0a4 Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Mon, 23 Jun 2025 09:05:10 +0200 Subject: clippy: Use strip_prefix instead of start_prefix + manual slicing --- server/common/src/git.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'server/common') diff --git a/server/common/src/git.rs b/server/common/src/git.rs index 37995b3..07c7e32 100644 --- a/server/common/src/git.rs +++ b/server/common/src/git.rs @@ -160,9 +160,9 @@ fn parse_tree_entries(output: String) -> Vec { fn branch_eq(a: impl AsRef, b: impl AsRef) -> bool { let a = a.as_ref(); let b = b.as_ref(); - if a.starts_with("refs/heads/") { - if b.starts_with("refs/heads/") { - return a[11..] == b[11..]; + if let Some(stripped_a) = a.strip_prefix("refs/heads/") { + if let Some(stripped_b) = b.strip_prefix("refs/heads/") { + return stripped_a == stripped_b; } return a == format!("refs/heads/{b}"); } else { -- cgit v1.2.3-70-g09d2