mirror of
https://github.com/ipetkov/crane.git
synced 2024-11-26 09:08:57 +03:00
9b32adff97
--------- Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
50 lines
1.0 KiB
Nix
50 lines
1.0 KiB
Nix
{ buildDepsOnly
|
|
, cargoClippy
|
|
, crateNameFromCargoToml
|
|
, linkFarmFromDrvs
|
|
, mkDummySrc
|
|
}:
|
|
|
|
let
|
|
src = ./clippytest;
|
|
cargoArtifacts = buildDepsOnly {
|
|
inherit src;
|
|
};
|
|
in
|
|
linkFarmFromDrvs "clippy-tests" (builtins.attrValues {
|
|
clippytest = cargoClippy {
|
|
inherit cargoArtifacts src;
|
|
};
|
|
|
|
dummySrc = cargoClippy ((crateNameFromCargoToml { inherit src; }) // {
|
|
cargoArtifacts = null;
|
|
src = mkDummySrc {
|
|
inherit 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
|
|
'';
|
|
};
|
|
})
|