From 4286590fd981f74e635556a942b59d7dcb6d1067 Mon Sep 17 00:00:00 2001 From: Fintan Halpenny Date: Tue, 17 Feb 2026 11:15:37 +0000 Subject: [PATCH] fetch: move `Component::from` outside of loop The previous code would convert the `remote` into a `Component` on each iteration of the loop. The conversion now happens outside of the loop and can be reused. --- crates/radicle-fetch/src/git/mem.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/radicle-fetch/src/git/mem.rs b/crates/radicle-fetch/src/git/mem.rs index 8849b973..f0494086 100644 --- a/crates/radicle-fetch/src/git/mem.rs +++ b/crates/radicle-fetch/src/git/mem.rs @@ -26,10 +26,10 @@ impl Refdb { &'a self, remote: &'a PublicKey, ) -> impl Iterator + 'a { + let remote = Component::from(remote); self.0.iter().filter_map(move |(refname, oid)| { let ns = refname.to_namespaced()?; - (ns.namespace() == Component::from(remote)) - .then(|| (ns.strip_namespace().to_ref_string(), *oid)) + (ns.namespace() == remote).then(|| (ns.strip_namespace().to_ref_string(), *oid)) }) }