Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix regression due to pending stabilization of Iterator::flatten #12

Merged
merged 1 commit into from
Jun 15, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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