Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
REVIEW: Use peekable to only collect when the iterator has items
Fintan Halpenny committed 22 days ago
commit 7f1f2767f54807c497febf9dbaad1cc00c6f974e
parent 2d626cecfbc8b300b5960e6ddb9b5f39f8ca2bb6
1 file changed +4 -4
modified crates/radicle/src/identity/crefs.rs
@@ -111,13 +111,13 @@ impl CanonicalRefs {
                continue;
            };

-
            let patterns = rules
+
            let mut patterns = rules
                .matches(&name)
                .map(|(pattern, _)| pattern.to_string())
-
                .collect::<Vec<_>>();
-
            if !patterns.is_empty() {
+
                .peekable();
+
            if patterns.peek().is_some() {
                return Err(ValidationError::Clash {
-
                    patterns,
+
                    patterns: patterns.collect(),
                    name: name.to_owned(),
                });
            }