Skip to content

Commit

Permalink
tidy some closures and iterators
Browse files Browse the repository at this point in the history
  • Loading branch information
danieleades committed Jun 23, 2021
1 parent 9233aa0 commit 8501a5b
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/cargo/core/compiler/custom_build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 299,7 @@ fn build_work(cx: &mut Context<'_, '_>, unit: &Unit) -> CargoResult<Job> {

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

Expand Down
7 changes: 1 addition & 6 deletions src/cargo/core/compiler/fingerprint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1320,12 1320,7 @@ fn calculate_normal(cx: &mut Context<'_, '_>, unit: &Unit) -> CargoResult<Finger
let metadata = util::hash_u64((&m.authors, &m.description, &m.homepage, &m.repository));
let mut config = 0u64;
if unit.mode.is_doc() && cx.bcx.config.cli_unstable().rustdoc_map {
config = config.wrapping_add(
cx.bcx
.config
.doc_extern_map()
.map_or(0, |map| util::hash_u64(map)),
);
config = config.wrapping_add(cx.bcx.config.doc_extern_map().map_or(0, util::hash_u64));
}
if let Some(allow_features) = &cx.bcx.config.cli_unstable().allow_features {
config = config.wrapping_add(util::hash_u64(allow_features));
Expand Down
3 changes: 1 addition & 2 deletions src/cargo/core/compiler/job_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1127,8 1127,7 @@ impl<'cfg> DrainState<'cfg> {
.bcx
.unit_graph
.keys()
.filter(|unit| unit.pkg.name() == "diesel" && !unit.features.is_empty())
.next()
.find(|unit| unit.pkg.name() == "diesel" && !unit.features.is_empty())
{
Some(u) => u,
// Unlikely due to features.
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/core/compiler/timings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 529,7 @@ impl<'cfg> Timings<'cfg> {
target: ut.target.clone(),
start: round(ut.start),
duration: round(ut.duration),
rmeta_time: ut.rmeta_time.map(|t| round(t)),
rmeta_time: ut.rmeta_time.map(round),
unlocked_units,
unlocked_rmeta_units,
}
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/ops/cargo_compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 568,7 @@ pub fn create_bcx<'a, 'cfg>(
// the target is a binary. Binary crates get their private items
// documented by default.
if rustdoc_document_private_items || unit.target.is_bin() {
let mut args = extra_args.take().unwrap_or_else(|| vec![]);
let mut args = extra_args.take().unwrap_or_default();
args.push("--document-private-items".into());
extra_args = Some(args);
}
Expand Down

0 comments on commit 8501a5b

Please sign in to comment.