From f352e98ddc17a992d724053e89479e0fbf080343 Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Thu, 5 Jul 2018 19:30:06 +0200 Subject: [PATCH] Address review comments --- src/bootstrap/lib.rs | 1 + src/bootstrap/tool.rs | 17 +++++------------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 414f17dfad4..29ba635a9b7 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -115,6 +115,7 @@ #![deny(warnings)] #![feature(core_intrinsics)] +#![feature(drain_filter)] #[macro_use] extern crate build_helper; diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs index ec904eb2134..12b3d59e93d 100644 --- a/src/bootstrap/tool.rs +++ b/src/bootstrap/tool.rs @@ -186,27 +186,20 @@ fn run(self, builder: &Builder) -> Option { than in a previous build:\n"); println!("the following dependencies are duplicated although they \ have the same features enabled:"); - for (id, cur, prev) in &duplicates { + for (id, cur, prev) in duplicates.drain_filter(|(_, cur, prev)| cur.2 == prev.2) { println!(" {}", id); - if cur.2 == prev.2 { - // same features - println!(" `{}` ({:?})\n `{}` ({:?})", cur.0, cur.1, prev.0, prev.1); - } + // same features + println!(" `{}` ({:?})\n `{}` ({:?})", cur.0, cur.1, prev.0, prev.1); } println!("the following dependencies have different features:"); for (id, cur, prev) in duplicates { println!(" {}", id); - if cur.2 == prev.2 { - continue; - } let cur_features: HashSet<_> = cur.2.into_iter().collect(); let prev_features: HashSet<_> = prev.2.into_iter().collect(); - let cur_extra: Vec<_> = cur_features.difference(&prev_features).collect(); - let prev_extra: Vec<_> = prev_features.difference(&cur_features).collect(); println!(" `{}` additionally enabled features {:?} at {:?}", - cur.0, cur_extra, cur.1); + cur.0, &cur_features - &prev_features, cur.1); println!(" `{}` additionally enabled features {:?} at {:?}", - prev.0, prev_extra, prev.1); + prev.0, &prev_features - &cur_features, prev.1); } println!(""); panic!("tools should not compile multiple copies of the same crate"); -- 2.44.0