diff options
| author | Joel Klinghed <the_jk@spawned.biz> | 2025-06-23 09:05:10 +0200 |
|---|---|---|
| committer | Joel Klinghed <the_jk@spawned.biz> | 2025-06-23 09:05:10 +0200 |
| commit | 0784fd95bcca54c01285097eddea01020203e0a4 (patch) | |
| tree | 54f2cc8385a10759a0e0ddd4905c65e23df1e5a5 /server/common | |
| parent | f9b7c2a14c939d0bb7d1ac2fcca3116e38e37f74 (diff) | |
clippy: Use strip_prefix instead of start_prefix + manual slicing
Diffstat (limited to 'server/common')
| -rw-r--r-- | server/common/src/git.rs | 6 |
1 files changed, 3 insertions, 3 deletions
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<TreeEntry> { fn branch_eq(a: impl AsRef<str>, b: impl AsRef<str>) -> 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 { |
