From 565a026cc93c46b31fb8421820db687adf3e1b63 Mon Sep 17 00:00:00 2001 From: steven-omaha <35634100+steven-omaha@users.noreply.github.com> Date: Thu, 2 Feb 2023 14:45:36 +0100 Subject: [PATCH] refactor reviewsperbackend --- src/review/datastructures.rs | 12 +++++++++--- src/review/mod.rs | 2 +- src/review/strategy.rs | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/review/datastructures.rs b/src/review/datastructures.rs index 2532e12..8b9632d 100644 --- a/src/review/datastructures.rs +++ b/src/review/datastructures.rs @@ -22,15 +22,21 @@ pub(super) enum ReviewIntention { } #[derive(Debug)] -pub(super) struct ReviewsPerBackend(pub Vec<(Box, Vec)>); +pub(super) struct ReviewsPerBackend { + pub items: Vec<(Box, Vec)>, +} impl ReviewsPerBackend { pub(super) fn new() -> Self { - Self(vec![]) + Self { items: vec![] } } pub(super) fn nothing_to_do(&self) -> bool { - self.0.iter().all(|(_, vec)| vec.is_empty()) + self.items.iter().all(|(_, vec)| vec.is_empty()) + } + + pub(super) fn push(&mut self, value: (Box, Vec)) { + self.items.push(value); } } diff --git a/src/review/mod.rs b/src/review/mod.rs index 8f924cf..410ace6 100644 --- a/src/review/mod.rs +++ b/src/review/mod.rs @@ -36,7 +36,7 @@ pub(crate) fn review( ContinueWithReview::No => return Ok(()), } } - reviews.0.push((backend, actions)); + reviews.push((backend, actions)); } if reviews.nothing_to_do() { diff --git a/src/review/strategy.rs b/src/review/strategy.rs index 06d0523..ce9b915 100644 --- a/src/review/strategy.rs +++ b/src/review/strategy.rs @@ -84,7 +84,7 @@ impl From for Vec { fn from(reviews: ReviewsPerBackend) -> Self { let mut result = vec![]; - for (backend, actions) in reviews.0 { + for (backend, actions) in reviews.items { let (to_delete, assign_group, as_dependency) = divide_actions(actions); result.push(Strategy::new(