From dabfc60221c1c7cee842ef61b2a6b534c8d07467 Mon Sep 17 00:00:00 2001 From: Stu Hood Date: Tue, 26 Jun 2018 22:31:34 -0700 Subject: [PATCH] Switch to explicit usage of Itertools::flatten to fix https://github.com/rust-lang/rust/issues/48919. --- src/rust/engine/fs/src/snapshot.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/rust/engine/fs/src/snapshot.rs b/src/rust/engine/fs/src/snapshot.rs index e5b24aaf343..758fad16318 100644 --- a/src/rust/engine/fs/src/snapshot.rs +++ b/src/rust/engine/fs/src/snapshot.rs @@ -163,10 +163,10 @@ impl Snapshot { // `Directory` structure. Only `Dir+Dir` collisions are legal. let path_stats = { let mut uniq_paths: IndexMap = IndexMap::new(); - for path_stat in snapshots + for path_stat in Itertools::flatten(snapshots .iter() .map(|s| s.path_stats.iter().cloned()) - .flatten() + ) { match uniq_paths.entry(path_stat.path().to_owned()) { indexmap::map::Entry::Occupied(e) => match (&path_stat, e.get()) { @@ -223,10 +223,10 @@ impl Snapshot { // Merge FileNodes. out_dir.set_files(protobuf::RepeatedField::from_vec( - directories + Itertools::flatten(directories .iter_mut() .map(|directory| directory.take_files().into_iter()) - .flatten() + ) .collect(), )); out_dir.mut_files().sort_by(|a, b| a.name.cmp(&b.name)); @@ -253,10 +253,10 @@ impl Snapshot { // Group and recurse for DirectoryNodes. let sorted_child_directories = { - let mut merged_directories = directories + let mut merged_directories = Itertools::flatten(directories .iter_mut() .map(|directory| directory.take_directories().into_iter()) - .flatten() + ) .collect::>(); merged_directories.sort_by(|a, b| a.name.cmp(&b.name)); merged_directories