refactor reviewsperbackend

This commit is contained in:
Dr. Matthias Ratajczak
2023-02-02 14:45:36 +01:00
parent 4d2da4cb8d
commit 52aa2696a5
3 changed files with 11 additions and 5 deletions
+9 -3
View File
@@ -22,15 +22,21 @@ pub(super) enum ReviewIntention {
}
#[derive(Debug)]
pub(super) struct ReviewsPerBackend(pub Vec<(Box<dyn Backend>, Vec<ReviewAction>)>);
pub(super) struct ReviewsPerBackend {
pub items: Vec<(Box<dyn Backend>, Vec<ReviewAction>)>,
}
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<dyn Backend>, Vec<ReviewAction>)) {
self.items.push(value);
}
}
+1 -1
View File
@@ -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() {
+1 -1
View File
@@ -84,7 +84,7 @@ impl From<ReviewsPerBackend> for Vec<Strategy> {
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(