From 8b2aa45df1e49a9f9f0e36046c81414281b2d151 Mon Sep 17 00:00:00 2001 From: Maksym Arutyunyan Date: Sun, 21 Jul 2024 20:10:06 +0200 Subject: [PATCH] broken calculate_sort_key --- src/block.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/block.rs b/src/block.rs index 3d3aa03..bedbb6e 100644 --- a/src/block.rs +++ b/src/block.rs @@ -56,10 +56,17 @@ impl<'a> Item<'a> { fn add_item(&mut self, line: &'a str) { self.item.push(line); + self.calculate_sort_key(); + } + + fn calculate_sort_key(&mut self) { + todo!("fix this"); + let joined = self.item.join("\n"); + let text = joined.as_str(); self.sort_key = match self.strategy { - SortStrategy::Generic => SortKey::Generic(line), - SortStrategy::Bazel => SortKey::Bazel(BazelSortKey::new(line)), - SortStrategy::CargoToml => SortKey::Generic(line), + SortStrategy::Generic => SortKey::Generic(text), + SortStrategy::Bazel => SortKey::Bazel(BazelSortKey::new(text)), + SortStrategy::CargoToml => SortKey::Generic(text), }; } }