From 17a76b8c15f2579e9162320c0e27b7619e9fc86a Mon Sep 17 00:00:00 2001 From: Matt Brubeck Date: Wed, 24 Jan 2018 12:37:19 -0800 Subject: [PATCH 1/2] cargo doc: Generate metadata instead of compiling dependencies --- src/cargo/ops/cargo_rustc/context.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/cargo/ops/cargo_rustc/context.rs b/src/cargo/ops/cargo_rustc/context.rs index f9c0cec873d..da22f57ed95 100644 --- a/src/cargo/ops/cargo_rustc/context.rs +++ b/src/cargo/ops/cargo_rustc/context.rs @@ -940,7 +940,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> { ret.push(Unit { pkg: dep, target: lib, - profile: self.lib_profile(), + profile: self.lib_or_check_profile(unit, lib), kind: unit.kind.for_target(lib), }); if self.build_config.doc_all { @@ -1057,6 +1057,9 @@ impl<'a, 'cfg> Context<'a, 'cfg> { pub fn lib_or_check_profile(&self, unit: &Unit, target: &Target) -> &'a Profile { if unit.profile.check && !target.is_custom_build() && !target.for_host() { &self.profiles.check + } else if unit.profile.doc && !unit.profile.test && + !target.is_custom_build() && !target.for_host() { + &self.profiles.check } else { self.lib_profile() } From 9bb9dbd3c331486a7663602097141356c82c13f4 Mon Sep 17 00:00:00 2001 From: Matt Brubeck Date: Mon, 5 Feb 2018 10:31:22 -0800 Subject: [PATCH 2/2] Clean up lib_or_check_profile code --- src/cargo/ops/cargo_rustc/context.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/cargo/ops/cargo_rustc/context.rs b/src/cargo/ops/cargo_rustc/context.rs index da22f57ed95..325d7434637 100644 --- a/src/cargo/ops/cargo_rustc/context.rs +++ b/src/cargo/ops/cargo_rustc/context.rs @@ -1055,14 +1055,12 @@ impl<'a, 'cfg> Context<'a, 'cfg> { } pub fn lib_or_check_profile(&self, unit: &Unit, target: &Target) -> &'a Profile { - if unit.profile.check && !target.is_custom_build() && !target.for_host() { - &self.profiles.check - } else if unit.profile.doc && !unit.profile.test && - !target.is_custom_build() && !target.for_host() { - &self.profiles.check - } else { - self.lib_profile() + if !target.is_custom_build() && !target.for_host() { + if unit.profile.check || (unit.profile.doc && !unit.profile.test) { + return &self.profiles.check + } } + self.lib_profile() } pub fn build_script_profile(&self, _pkg: &PackageId) -> &'a Profile {