Commit 016ba92a authored by Yueh-Shun Li's avatar Yueh-Shun Li
Browse files

buildRustPackage: avoid global assertions

Move assertions down to the corresponding attribute value.

Avoid adding assertions to the whole argument set.
parent 85931b40
Loading
Loading
Loading
Loading
+2 −6
Original line number Diff line number Diff line
@@ -62,12 +62,6 @@
  ...
}@args:

assert
  cargoVendorDir == null && cargoDeps == null && cargoLock == null
  ->
    !(args ? cargoSha256 && args.cargoSha256 != null) && !(args ? cargoHash && args.cargoHash != null)
  -> throw "cargoHash, cargoVendorDir, cargoDeps, or cargoLock must be set";

let

  cargoDeps' =
@@ -77,6 +71,8 @@ let
      cargoDeps
    else if cargoLock != null then
      importCargoLock cargoLock
    else if (args.cargoHash or null == null) && (args.cargoSha256 or null == null) then
      throw "cargoHash, cargoVendorDir, cargoDeps, or cargoLock must be set"
    else if useFetchCargoVendor then
      fetchCargoVendor (
        {