build-rust-crate: cleanup with statix

This commit is contained in:
Sandro Jäckel 2023-06-15 01:26:03 +02:00
parent 0138c0f6ed
commit ddad581c0d
No known key found for this signature in database
GPG Key ID: 3AF5A43A3EECC2E5
2 changed files with 4 additions and 6 deletions

View File

@ -7,7 +7,7 @@
dependencies,
crateFeatures, crateRenames, libName, release, libPath,
crateType, metadata, crateBin, hasCrateBin,
extraRustcOpts, verbose, colors,
extraRustcOpts,
buildTests,
codegenUnits
}:
@ -40,9 +40,7 @@
++ (map (x: "--crate-type ${x}") crateType)
);
binRustcOpts = lib.concatStringsSep " " (
baseRustcOpts
);
binRustcOpts = lib.concatStringsSep " " baseRustcOpts;
build_bin = if buildTests then "build_bin_test" else "build_bin";
in ''

View File

@ -300,7 +300,7 @@ crate_: lib.makeOverridable
(crate.features ++ features)
);
libName = if crate ? libName then crate.libName else crate.crateName;
libName = crate.libName or crate.crateName;
libPath = lib.optionalString (crate ? libPath) crate.libPath;
# Seed the symbol hashes with something unique every time.
@ -329,7 +329,7 @@ crate_: lib.makeOverridable
colors = lib.attrByPath [ "colors" ] "always" crate;
extraLinkFlags = lib.concatStringsSep " " (crate.extraLinkFlags or [ ]);
edition = crate.edition or null;
codegenUnits = if crate ? codegenUnits then crate.codegenUnits else 1;
codegenUnits = crate.codegenUnits or 1;
extraRustcOpts =
lib.optionals (crate ? extraRustcOpts) crate.extraRustcOpts
++ extraRustcOpts_