crane/checks/clippy/default.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

41 lines
843 B
Nix

{ buildDepsOnly
, cargoClippy
, linkFarmFromDrvs
}:
let
src = ./clippytest;
cargoArtifacts = buildDepsOnly {
inherit src;
};
in
linkFarmFromDrvs "clippy-tests" (builtins.attrValues {
clippytest = cargoClippy {
inherit cargoArtifacts src;
};
checkWarnings = cargoClippy {
inherit cargoArtifacts src;
pname = "checkWarnings";
cargoClippyExtraArgs = "--all-targets 2>clippy.log";
installPhaseCommand = ''
grep 'warning: use of `println!`' <clippy.log
mkdir -p $out
'';
};
denyWarnings = cargoClippy {
inherit cargoArtifacts src;
pname = "denyWarnings";
cargoClippyExtraArgs = ''
--all-targets -- --deny warnings 2>clippy.log || [ "0" != "$?" ]
'';
installPhaseCommand = ''
grep 'error: use of `println!`' <clippy.log
mkdir -p $out
'';
};
})