File tree Expand file tree Collapse file tree 2 files changed +18
-30
lines changed
Expand file tree Collapse file tree 2 files changed +18
-30
lines changed Original file line number Diff line number Diff line change 77 RUST_BACKTRACE : full
88
99jobs :
10- format :
11- name : Format
10+ style :
11+ name : Code style check
1212 runs-on : ubuntu-latest
1313 steps :
1414 - name : Checkout
1515 uses : actions/checkout@v3
16- - name : Install Rust
17- uses : actions-rs/toolchain@v1
18- with :
19- profile : minimal
20- toolchain : nightly
21- components : rustfmt
22- - name : Check format
23- run : cargo fmt --all -- --check
24-
25- clippy :
26- name : Clippy
27- runs-on : ubuntu-latest
28- steps :
29- - name : Checkout
30- uses : actions/checkout@v3
31- # For builtins.
3216 - name : Install Nix
3317 uses : cachix/install-nix-action@v17
34- - name : Install Rust
35- uses : actions-rs/toolchain@v1
36- with :
37- profile : minimal
38- toolchain : stable
39- components : clippy
40- - name : Check clippy
41- run : cargo clippy --all -- -D warnings
18+ - name : Prepare devShell
19+ run : nix develop --command true
20+ - name : Run pre-commit
21+ run : nix develop --command pre-commit
4222
4323 test :
4424 name : Test
Original file line number Diff line number Diff line change 3838 pkgs = nixpkgs . legacyPackages . ${ system } ;
3939 rustPkgs = rust-overlay . packages . ${ system } ;
4040
41+ clippyFlags = lib . concatStringsSep " " [
42+ "-D" "warnings"
43+ "-D" "clippy::dbg_macro"
44+ ] ;
45+
4146 pre-commit = pkgs . writeShellScriptBin "pre-commit" ''
4247 set -e
4348 die() { echo "$*" >&2; exit 1; }
4449
45- cd "$(git rev-parse --show-toplevel)"
46- rg --fixed-strings 'dbg!' --glob '*.rs' \
47- && die 'Found dbg!()'
48- cargo fmt --quiet --check >/dev/null \
50+ if git_dir= "$(git rev-parse --show-toplevel)"; then
51+ cd "$git_dir"
52+ fi
53+ cargo fmt --all --check \
4954 || die 'Format failed'
55+ cargo clippy --all --all-targets -- ${ clippyFlags } \
56+ || die 'Clippy failed'
5057 '' ;
5158
5259 nil = pkgs . callPackage mkNil { } ;
7986
8087 RUST_BACKTRACE = "short" ;
8188 NIXPKGS = nixpkgs ;
89+ CLIPPY_FLAGS = clippyFlags ;
8290
8391 # bash
8492 shellHook = ''
You can’t perform that action at this time.
0 commit comments