Skip to content

Commit

Permalink
Merge pull request #12 from Centril/patch-1
Browse files Browse the repository at this point in the history
Fix regression due to pending stabilization of Iterator::flatten
  • Loading branch information
lukaspustina authored Jun 15, 2018
2 parents 6d34a66 + 110aedc commit 700aecb
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/summary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ fn alerts(responses: &[&Response]) -> Vec<Alert> {
// TODO: &[&T] is totally weird
fn check_soa_serial_numbers(responses: &[&Response]) -> Option<Alert> {
let mut serial_counts = HashMap::new();
responses
Itertools::flatten(
responses
.iter()
.map(|r| r.answers
.iter()
Expand All @@ -119,12 +120,12 @@ fn check_soa_serial_numbers(responses: &[&Response]) -> Option<Alert> {
_ => None
})
)
.flatten()
.filter_map(|x| x)
.for_each(|key| {
let value = serial_counts.entry(key).or_insert(0);
*value += 1;
});
)
.filter_map(|x| x)
.for_each(|key| {
let value = serial_counts.entry(key).or_insert(0);
*value += 1;
});

if serial_counts.len() > 1 {
Some(Alert::SoaSnDiverge(serial_counts))
Expand Down

0 comments on commit 700aecb

Please sign in to comment.