Skip to content

Commit 9bb9dbd

Browse files
committed
Clean up lib_or_check_profile code
1 parent 17a76b8 commit 9bb9dbd

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/cargo/ops/cargo_rustc/context.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,14 +1055,12 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
10551055
}
10561056

10571057
pub fn lib_or_check_profile(&self, unit: &Unit, target: &Target) -> &'a Profile {
1058-
if unit.profile.check && !target.is_custom_build() && !target.for_host() {
1059-
&self.profiles.check
1060-
} else if unit.profile.doc && !unit.profile.test &&
1061-
!target.is_custom_build() && !target.for_host() {
1062-
&self.profiles.check
1063-
} else {
1064-
self.lib_profile()
1058+
if !target.is_custom_build() && !target.for_host() {
1059+
if unit.profile.check || (unit.profile.doc && !unit.profile.test) {
1060+
return &self.profiles.check
1061+
}
10651062
}
1063+
self.lib_profile()
10661064
}
10671065

10681066
pub fn build_script_profile(&self, _pkg: &PackageId) -> &'a Profile {

0 commit comments

Comments
 (0)