refactor reviewsperbackend
This commit is contained in:
@@ -22,15 +22,21 @@ pub(super) enum ReviewIntention {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[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 {
|
impl ReviewsPerBackend {
|
||||||
pub(super) fn new() -> Self {
|
pub(super) fn new() -> Self {
|
||||||
Self(vec![])
|
Self { items: vec![] }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn nothing_to_do(&self) -> bool {
|
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
@@ -36,7 +36,7 @@ pub(crate) fn review(
|
|||||||
ContinueWithReview::No => return Ok(()),
|
ContinueWithReview::No => return Ok(()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
reviews.0.push((backend, actions));
|
reviews.push((backend, actions));
|
||||||
}
|
}
|
||||||
|
|
||||||
if reviews.nothing_to_do() {
|
if reviews.nothing_to_do() {
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ impl From<ReviewsPerBackend> for Vec<Strategy> {
|
|||||||
fn from(reviews: ReviewsPerBackend) -> Self {
|
fn from(reviews: ReviewsPerBackend) -> Self {
|
||||||
let mut result = vec![];
|
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);
|
let (to_delete, assign_group, as_dependency) = divide_actions(actions);
|
||||||
|
|
||||||
result.push(Strategy::new(
|
result.push(Strategy::new(
|
||||||
|
|||||||
Reference in New Issue
Block a user