From 28881a4ec582aaa83a40a23edb80f228102d151c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Sun, 23 Feb 2025 18:20:42 +0100 Subject: [PATCH] fix: create all permutations of depth for tree command --- src/tag_engine.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/tag_engine.rs b/src/tag_engine.rs index 89503ff..db8d6d9 100644 --- a/src/tag_engine.rs +++ b/src/tag_engine.rs @@ -95,14 +95,12 @@ pub fn create_tag_combinations(tags: &[String], depth: usize) -> Vec // Start with existing combinations of length-1 for combo in result.iter().filter(|c| c.len() == len - 1) { - // Try to add each remaining tag that comes after the last tag in combo - if let Some(last) = combo.last() { - for tag in tags { - if tag > last && !combo.contains(tag) { - let mut new_combo = combo.clone(); - new_combo.push(tag.clone()); - temp.push(new_combo); - } + // Try to add each remaining tag + for tag in tags { + if !combo.contains(tag) { + let mut new_combo = combo.clone(); + new_combo.push(tag.clone()); + temp.push(new_combo); } } }