Skip to content

Commit

Permalink
Switch to explicit usage of Itertools::flatten to fix rust-lang/rust#…
Browse files Browse the repository at this point in the history
  • Loading branch information
stuhood committed Jun 27, 2018
1 parent ab3bb0d commit dabfc60
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/rust/engine/fs/src/snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,10 @@ impl Snapshot {
// `Directory` structure. Only `Dir+Dir` collisions are legal.
let path_stats = {
let mut uniq_paths: IndexMap<PathBuf, PathStat> = 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()) {
Expand Down Expand Up @@ -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));
Expand All @@ -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::<Vec<_>>();
merged_directories.sort_by(|a, b| a.name.cmp(&b.name));
merged_directories
Expand Down

0 comments on commit dabfc60

Please sign in to comment.