Fix Unit/Context parameter order.
authorEric Huss <eric@huss.org>
Tue, 24 Apr 2018 17:12:53 +0000 (10:12 -0700)
committerEric Huss <eric@huss.org>
Fri, 27 Apr 2018 20:42:30 +0000 (13:42 -0700)
src/cargo/core/compiler/context/unit_dependencies.rs

index 75dbd24f1e69b0d59ec717d90194d34cf45b2d1c..e5fdcb5232fe6762e216be18e8a32cca19b1c5ca 100644 (file)
@@ -132,7 +132,7 @@ fn compute_deps<'a, 'b, 'cfg>(
     if unit.target.is_custom_build() {
         return Ok(ret);
     }
-    ret.extend(dep_build_script(cx, unit));
+    ret.extend(dep_build_script(unit, cx));
 
     // If this target is a binary, test, example, etc, then it depends on
     // the library of the same package. The call to `resolve.deps` above
@@ -141,7 +141,7 @@ fn compute_deps<'a, 'b, 'cfg>(
     if unit.target.is_lib() && unit.mode != CompileMode::Doctest {
         return Ok(ret);
     }
-    ret.extend(maybe_lib(cx, unit, profile_for));
+    ret.extend(maybe_lib(unit, cx, profile_for));
 
     Ok(ret)
 }
@@ -178,7 +178,7 @@ fn compute_deps_custom_build<'a, 'cfg>(
             if !unit.target.linkable() || unit.pkg.manifest().links().is_none() {
                 return None;
             }
-            dep_build_script(cx, unit)
+            dep_build_script(unit, cx)
         })
         .chain(Some((
             new_unit(
@@ -248,18 +248,18 @@ fn compute_deps_doc<'a, 'cfg>(
     }
 
     // Be sure to build/run the build script for documented libraries as
-    ret.extend(dep_build_script(cx, unit));
+    ret.extend(dep_build_script(unit, cx));
 
     // If we document a binary, we need the library available
     if unit.target.is_bin() {
-        ret.extend(maybe_lib(cx, unit, ProfileFor::Any));
+        ret.extend(maybe_lib(unit, cx, ProfileFor::Any));
     }
     Ok(ret)
 }
 
 fn maybe_lib<'a>(
-    cx: &Context,
     unit: &Unit<'a>,
+    cx: &Context,
     profile_for: ProfileFor,
 ) -> Option<(Unit<'a>, ProfileFor)> {
     let mode = check_or_build_mode(&unit.mode, unit.target);
@@ -276,7 +276,7 @@ fn maybe_lib<'a>(
 /// script itself doesn't have any dependencies, so even in that case a unit
 /// of work is still returned. `None` is only returned if the package has no
 /// build script.
-fn dep_build_script<'a>(cx: &Context, unit: &Unit<'a>) -> Option<(Unit<'a>, ProfileFor)> {
+fn dep_build_script<'a>(unit: &Unit<'a>, cx: &Context) -> Option<(Unit<'a>, ProfileFor)> {
     unit.pkg
         .targets()
         .iter()