Clean up lib_or_check_profile code
authorMatt Brubeck <mbrubeck@limpet.net>
Mon, 5 Feb 2018 18:31:22 +0000 (10:31 -0800)
committerMatt Brubeck <mbrubeck@limpet.net>
Mon, 5 Feb 2018 18:46:20 +0000 (10:46 -0800)
src/cargo/ops/cargo_rustc/context.rs

index da22f57ed951fee6bf265d5110a1f656ca94e645..325d743463787436a8f438a6ec25b92523e60bd8 100644 (file)
@@ -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 {