Skip to content

Commit e5917a2

Browse files
committed
Auto merge of #9614 - danieleades:refactor/closures-and-iterators, r=Eh2406
tidy some closures and iterators
2 parents 58be979 + 8501a5b commit e5917a2

File tree

5 files changed

+5
-11
lines changed

5 files changed

+5
-11
lines changed

src/cargo/core/compiler/custom_build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ fn build_work(cx: &mut Context<'_, '_>, unit: &Unit) -> CargoResult<Job> {
299299

300300
let extra_link_arg = cx.bcx.config.cli_unstable().extra_link_arg;
301301
let nightly_features_allowed = cx.bcx.config.nightly_features_allowed;
302-
let targets: Vec<Target> = unit.pkg.targets().iter().cloned().collect();
302+
let targets: Vec<Target> = unit.pkg.targets().to_vec();
303303
// Need a separate copy for the fresh closure.
304304
let targets_fresh = targets.clone();
305305

src/cargo/core/compiler/fingerprint.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,12 +1320,7 @@ fn calculate_normal(cx: &mut Context<'_, '_>, unit: &Unit) -> CargoResult<Finger
13201320
let metadata = util::hash_u64((&m.authors, &m.description, &m.homepage, &m.repository));
13211321
let mut config = 0u64;
13221322
if unit.mode.is_doc() && cx.bcx.config.cli_unstable().rustdoc_map {
1323-
config = config.wrapping_add(
1324-
cx.bcx
1325-
.config
1326-
.doc_extern_map()
1327-
.map_or(0, |map| util::hash_u64(map)),
1328-
);
1323+
config = config.wrapping_add(cx.bcx.config.doc_extern_map().map_or(0, util::hash_u64));
13291324
}
13301325
if let Some(allow_features) = &cx.bcx.config.cli_unstable().allow_features {
13311326
config = config.wrapping_add(util::hash_u64(allow_features));

src/cargo/core/compiler/job_queue.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,8 +1127,7 @@ impl<'cfg> DrainState<'cfg> {
11271127
.bcx
11281128
.unit_graph
11291129
.keys()
1130-
.filter(|unit| unit.pkg.name() == "diesel" && !unit.features.is_empty())
1131-
.next()
1130+
.find(|unit| unit.pkg.name() == "diesel" && !unit.features.is_empty())
11321131
{
11331132
Some(u) => u,
11341133
// Unlikely due to features.

src/cargo/core/compiler/timings.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ impl<'cfg> Timings<'cfg> {
529529
target: ut.target.clone(),
530530
start: round(ut.start),
531531
duration: round(ut.duration),
532-
rmeta_time: ut.rmeta_time.map(|t| round(t)),
532+
rmeta_time: ut.rmeta_time.map(round),
533533
unlocked_units,
534534
unlocked_rmeta_units,
535535
}

src/cargo/ops/cargo_compile.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ pub fn create_bcx<'a, 'cfg>(
568568
// the target is a binary. Binary crates get their private items
569569
// documented by default.
570570
if rustdoc_document_private_items || unit.target.is_bin() {
571-
let mut args = extra_args.take().unwrap_or_else(|| vec![]);
571+
let mut args = extra_args.take().unwrap_or_default();
572572
args.push("--document-private-items".into());
573573
extra_args = Some(args);
574574
}

0 commit comments

Comments
 (0)