refactor reviewsperbackend

This commit is contained in:
steven-omaha
2023-02-02 14:53:17 +01:00
parent 565a026cc9
commit ea76605a08
2 changed files with 12 additions and 2 deletions
+11 -1
View File
@@ -23,7 +23,7 @@ pub(super) enum ReviewIntention {
#[derive(Debug)] #[derive(Debug)]
pub(super) struct ReviewsPerBackend { pub(super) struct ReviewsPerBackend {
pub items: Vec<(Box<dyn Backend>, Vec<ReviewAction>)>, items: Vec<(Box<dyn Backend>, Vec<ReviewAction>)>,
} }
impl ReviewsPerBackend { impl ReviewsPerBackend {
@@ -40,6 +40,16 @@ impl ReviewsPerBackend {
} }
} }
impl IntoIterator for ReviewsPerBackend {
type Item = (Box<dyn Backend>, Vec<ReviewAction>);
type IntoIter = std::vec::IntoIter<(Box<dyn Backend>, Vec<ReviewAction>)>;
fn into_iter(self) -> Self::IntoIter {
self.items.into_iter()
}
}
pub(super) enum ContinueWithReview { pub(super) enum ContinueWithReview {
Yes, Yes,
No, No,
+1 -1
View File
@@ -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.items { for (backend, actions) in reviews {
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(