diff rust/hg-core/src/narrow.rs @ 49915:c8ef85ace216

rust-narrow: fix loop that never loops This was caught by `clippy`. I guess the narrow tests leave something to be desired, since this previously only checked the first valid pattern.
author Rapha?l Gom?s <rgomes@octobus.net>
date Mon, 09 Jan 2023 17:48:54 +0100
parents 7c93e38a0bbd
children e98fd81bb151
line wrap: on
line diff
--- a/rust/hg-core/src/narrow.rs	Mon Jan 09 17:40:03 2023 +0100
+++ b/rust/hg-core/src/narrow.rs	Mon Jan 09 17:48:54 2023 +0100
@@ -100,12 +100,12 @@
         }
         for prefix in VALID_PREFIXES.iter() {
             if pattern.starts_with(prefix.as_bytes()) {
-                break;
+                return Ok(());
             }
-            return Err(SparseConfigError::InvalidNarrowPrefix(
-                pattern.to_owned(),
-            ));
         }
+        return Err(SparseConfigError::InvalidNarrowPrefix(
+            pattern.to_owned(),
+        ));
     }
     Ok(())
 }