Skip to content

Commit dcf279d

Browse files
authored
init clippy (#780)
* lint: use clippy instead of hand-written `no_printlns`/`no_dbgs` * lint: fix `uninlined_format_args` * ci: run clippy on all crates
1 parent 1043fff commit dcf279d

File tree

19 files changed

+46
-100
lines changed

19 files changed

+46
-100
lines changed

.clippy.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
allow-print-in-tests = true

.github/features.ua

Lines changed: 0 additions & 20 deletions
This file was deleted.

.github/workflows/validate.yml

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,25 @@ jobs:
4242
- uses: actions/checkout@v4
4343
- name: Check formatting
4444
run: cargo fmt --all --check
45-
install_deps:
46-
needs: check_formatting
45+
clippy:
4746
runs-on: ubuntu-latest
4847
steps:
4948
- uses: actions/checkout@v4
50-
- name: Install depsAdd commentMore actions
49+
- uses: actions/cache@v4
50+
with:
51+
path: target
52+
key: build-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}
53+
restore-keys: |
54+
build-${{ runner.os }}-
55+
- name: Install deps
5156
run: |
5257
sudo apt-get update -y
5358
sudo apt-get --fix-missing install -y
54-
sudo apt-get install libasound2-dev libudev-dev pkg-config libx11-dev libjpeg-dev
55-
- name: Install WASM target
56-
run: rustup target add wasm32-unknown-unknown
59+
sudo apt-get install libasound2-dev
60+
- name: Run clippy
61+
run: cargo clippy --no-deps --all-targets --workspace --all-features -- --deny=warnings
5762
# Test the interpreter
5863
test_bin:
59-
needs: install_deps
6064
runs-on: ubuntu-latest
6165
steps:
6266
- uses: actions/checkout@v4
@@ -66,13 +70,10 @@ jobs:
6670
key: build-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}
6771
restore-keys: |
6872
build-${{ runner.os }}-
69-
- name: Check interpreter clippy lints
70-
run: cargo clippy --no-deps
7173
- name: Run interpreter tests
7274
run: cargo test --lib
7375
# Test the site
7476
test_site:
75-
needs: install_deps
7677
runs-on: ubuntu-latest
7778
steps:
7879
- uses: actions/checkout@v4
@@ -86,7 +87,6 @@ jobs:
8687
run: cargo test -p site
8788
# Test ffi
8889
test_ffi:
89-
needs: install_deps
9090
runs-on: ubuntu-latest
9191
steps:
9292
- uses: actions/checkout@v4
@@ -98,10 +98,3 @@ jobs:
9898
build-${{ runner.os }}-
9999
- name: Run site tests
100100
run: cargo test -p tests_ffi
101-
# check_features:
102-
# needs: test_bin
103-
# runs-on: ubuntu-latest
104-
# steps:
105-
# - uses: actions/checkout@v4
106-
# - name: Check feature combinations
107-
# run: cargo run ./.github/features.ua

Cargo.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,18 @@ system = ["libffi?/system"]
165165

166166
[[bin]]
167167
name = "uiua"
168+
required-features = ["binary"]
168169

169170
[workspace]
170171
members = ["site", "tests_ffi", "pad/editor", "parser"]
171172

173+
[workspace.lints.clippy]
174+
print_stdout = "warn"
175+
print_stderr = "allow"
176+
dbg_macro = "warn"
177+
178+
[lints]
179+
workspace = true
180+
172181
[profile.dev]
173182
incremental = true

pad/editor/.clippy.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../.clippy.toml

pad/editor/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ edition = "2021"
66
[lib]
77
crate-type = ["cdylib", "rlib"]
88

9+
[lints]
10+
workspace = true
11+
912
[dependencies]
1013
leptos = { version = "0.6.10", features = ["csr"] }
1114
js-sys = "0.3.69"

parser/.clippy.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../.clippy.toml

parser/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ repository = "https://github.com/uiua-lang/uiua"
1010
rust-version = "1.82.0"
1111
version = "0.17.0-dev.2"
1212

13+
[lints]
14+
workspace = true
15+
1316
[dependencies]
1417
bytemuck = {version = "1.17", features = ["must_cast", "derive", "extern_crate_alloc"]}
1518
colored = "2"

site/.clippy.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../.clippy.toml

site/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ edition = "2021"
33
name = "site"
44
version = "0.1.0"
55

6+
[lints]
7+
workspace = true
8+
69
[dependencies]
710
base64 = "0.22.0"
811
comrak = "0.39.0"

0 commit comments

Comments
 (0)