]> git.lizzy.rs Git - rust.git/blobdiff - src/test/mod.rs
Fix is_subpath
[rust.git] / src / test / mod.rs
index 2830f9aeff1ce3a674095069c750181e7f2ef618..5ac0a1d445099a27311b66fd3c19fa80292446b6 100644 (file)
@@ -66,7 +66,11 @@ fn is_subpath<P>(path: &Path, subpath: &P) -> bool
     P: AsRef<Path>,
 {
     (0..path.components().count())
-        .map(|i| path.components().take(i))
+        .map(|i| {
+            path.components()
+                .skip(i)
+                .take(subpath.as_ref().components().count())
+        })
         .any(|c| c.zip(subpath.as_ref().components()).all(|(a, b)| a == b))
 }