diff options
author | Matthias Beyer <matthias.beyer@atos.net> | 2021-08-27 16:30:00 +0200 |
---|---|---|
committer | Matthias Beyer <matthias.beyer@atos.net> | 2021-08-27 16:30:00 +0200 |
commit | ccd993982d22796b27f6604a3256eb43bbc706bf (patch) | |
tree | 1a315aa344d6f6fc72887f610798d14db951458b | |
parent | 791b49cb317dd9b654f67d9f5c1e5b2188804aa0 (diff) |
Optimize: If there is a PathComponent::PkgToml, we can return true right away
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
-rw-r--r-- | src/repository/fs/representation.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/repository/fs/representation.rs b/src/repository/fs/representation.rs index 19c06f8..d348f7e 100644 --- a/src/repository/fs/representation.rs +++ b/src/repository/fs/representation.rs @@ -123,6 +123,10 @@ impl FileSystemRepresentation { // Helper to check whether a tree contains pkg.toml files, recursively fn toml_files_in_tree(hm: &HashMap<PathComponent, Element>) -> bool { + if let Some(Element::File(_)) = hm.get(&PathComponent::PkgToml) { + return true + } + for value in hm.values() { match value { Element::File(_) => return true, |