chore: improve clippy CI
All checks were successful
Code quality / check (pull_request) Successful in 3m55s

This commit is contained in:
Naxdy 2024-10-14 17:20:18 +02:00
parent e15a7c7bec
commit dcc1f0d170
Signed by: Naxdy
GPG key ID: CC15075846BCE91B
4 changed files with 28 additions and 10 deletions

View file

@ -25,4 +25,4 @@ jobs:
- name: Run Clippy
run: |
nix develop . --command cargo clippy -- -Dwarnings
nix build .#clippy --print-build-logs -j auto

View file

@ -20,9 +20,15 @@ jobs:
token: "${{ secrets.PUBLIC_BINARY_CACHE_AUTH_KEY }}"
cache: "${{ vars.PUBLIC_BINARY_CACHE_NAME }}"
- uses: actions/checkout@v4
- name: Run Clippy
run: |
nix build .#clippy --print-build-logs -j auto
- name: Build firmware image
run: |
nix build .# -o dist --print-build-logs
- name: (Re-)generate tag
run: |
git config --global user.email "noreply@naxdy.org"
@ -32,6 +38,7 @@ jobs:
git tag nightly -m "Nightly Release"
git checkout nightly
git push --set-upstream origin nightly --force
- name: Publish nightly release
uses: https://gitea.com/actions/gitea-release-action@v1.3.0
with:

View file

@ -54,18 +54,26 @@
${pkgs.elf2uf2-rs}/bin/elf2uf2-rs ${self.packages.${system}.naxgcc-fw}/bin/${self.packages.${system}.naxgcc-fw.pname} $out/bin/${self.packages.${system}.naxgcc-fw.pname}.uf2
'';
packages.naxgcc-fw = naersk_lib.buildPackage {
pname = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package.name;
version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package.version;
packages.naxgcc-fw = pkgs.callPackage
({ mode ? "build" }: naersk_lib.buildPackage {
pname = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package.name;
version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package.version;
src = self;
inherit mode;
cargoBuildOptions = _orig: _orig ++ [
"--target=${CARGO_BUILD_TARGET}"
];
src = self;
# if a tree falls in the forest and no one is around to hear it, does it make a sound?
DEFMT_LOG = "off";
cargoBuildOptions = _orig: _orig ++ [
"--target=${CARGO_BUILD_TARGET}"
];
# if a tree falls in the forest and no one is around to hear it, does it make a sound?
DEFMT_LOG = "off";
})
{ };
packages.clippy = self.packages.${system}.naxgcc-fw.override {
mode = "clippy";
};
devShells.default = pkgs.mkShell {

View file

@ -130,6 +130,9 @@ impl MyDeviceHandler {
impl Handler for MyDeviceHandler {
fn enabled(&mut self, enabled: bool) {
self.configured = true;
// reason: in production, info! compiles to nothing
#[allow(clippy::if_same_then_else)]
if enabled {
info!("Device enabled");
} else {