crane/lib/cargoClippy.nix
Ivan Petkov 8de515289f
cargoClippy: add --all-targets to default cargoClippyExtraArgs (#67)
* This allows callers to opt-out of using `--all-targets` without having
  to override the entire cargo command itself
2022-08-11 23:58:32 +00:00

24 lines
540 B
Nix

{ cargoBuild
, clippy
}:
{ cargoArtifacts
, cargoClippyExtraArgs ? "--all-targets"
, cargoExtraArgs ? ""
, ...
}@origArgs:
let
args = builtins.removeAttrs origArgs [ "cargoClippyExtraArgs" ];
in
cargoBuild (args // {
inherit cargoArtifacts;
pnameSuffix = "-clippy";
cargoBuildCommand = "cargoWithProfile clippy";
cargoExtraArgs = "${cargoExtraArgs} ${cargoClippyExtraArgs}";
nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [ clippy ];
doCheck = false; # We don't need to run tests to benefit from `cargo clippy`
})