mirror of
https://github.com/ipetkov/crane.git
synced 2024-11-27 12:36:51 +03:00
8de515289f
* This allows callers to opt-out of using `--all-targets` without having to override the entire cargo command itself
41 lines
843 B
Nix
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
|
|
'';
|
|
};
|
|
})
|