From b503fd6811dfc309cd64dabb91ee2bcce2f601de Mon Sep 17 00:00:00 2001 From: white-axe Date: Tue, 10 Oct 2023 22:39:54 -0400 Subject: [PATCH] Move `skip` variable from previous commit outside of the loop --- src/filesystem/path_cache.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/filesystem/path_cache.rs b/src/filesystem/path_cache.rs index aeb7e3b0..a7ac0f7d 100644 --- a/src/filesystem/path_cache.rs +++ b/src/filesystem/path_cache.rs @@ -51,14 +51,13 @@ where path: impl AsRef, f: &mut impl FnMut(&camino::Utf8Path), ) -> Result<(), Error> { + // In web builds, RTPs are currently to be placed in the "RTP" subdirectory of + // the project root directory, so this is to avoid loading the contents of + // those directories twice + let skip = matches!(path.as_ref().iter().next_back(), Some("RTP")); + for entry in fs.read_dir(path)? { f(entry.path()); - - // In web builds, RTPs are currently to be placed in the "RTP" subdirectory of - // the project root directory, so this is to avoid loading the contents of - // those directories twice - let skip = matches!(entry.path().iter().nth_back(1), Some("RTP")); - if !skip && !entry.metadata().is_file { internal(fs, entry.path(), f)?; }