Skip to content

Commit 0d1a527

Browse files
authored
chore: add clippy rules for codebase consistency (#804)
* chore: add clippy rule for inline * chore: remove newline in Cargo.toml * ci: add workspace-lints * chore: separate with newlint in .clippy.toml * chore: make cargo sort happy * lint: add wildcard_imports * lint: add useless_let_if_seq * lint: add unwrap_used * lint: add unnecessary_debug_formatting * lint: add let_and_return * chore: remove leading dot of clippy.toml
1 parent fd0c9d1 commit 0d1a527

File tree

54 files changed

+166
-48
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+166
-48
lines changed

.github/workflows/optional-rust.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,15 @@ jobs:
2121

2222
- name: Run cargo udeps
2323
run: cargo +nightly udeps --workspace --tests --all-targets --release --exclude ef-tests
24+
25+
cargo-workspace-lints:
26+
runs-on: ubuntu-latest
27+
28+
steps:
29+
- uses: actions/checkout@v4
30+
31+
- name: Install cargo workspace lints
32+
run: cargo install cargo-workspace-lints --locked
33+
34+
- name: Run cargo workspace lints
35+
run: cargo workspace-lints

Cargo.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,14 @@ repository = "https://github.com/ReamLabs/ream"
6161
rust-version = "1.88.0"
6262
version = "0.1.0"
6363

64+
[workspace.lints.clippy]
65+
let_and_return = "warn"
66+
uninlined_format_args = "warn"
67+
unnecessary_debug_formatting = "warn"
68+
unwrap_used = "warn"
69+
useless_let_if_seq = "warn"
70+
wildcard_imports = "warn"
71+
6472
[workspace.dependencies]
6573
actix-web = "4.10.2"
6674
actix-web-lab = "0.24.1"

bin/ream/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,6 @@ ream-storage.workspace = true
5656
ream-sync.workspace = true
5757
ream-validator-beacon.workspace = true
5858
ream-validator-lean.workspace = true
59+
60+
[lints]
61+
workspace = true
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
allow-mixed-uninlined-format-args = false
2+
13
# This feature is in Rust nightly, as of v1.62. The line is added in anticipation.
24
# Once the feature stabilizes, remove the #[allow(clippy::unwrap_used)] lines in front of every `mod test`
35
allow-unwrap-in-tests = true

crates/common/account_manager/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ bip39.workspace = true
1414
rand.workspace = true
1515
rand_chacha.workspace = true
1616
sha2.workspace = true
17+
18+
[lints]
19+
workspace = true

crates/common/api_types/beacon/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ url.workspace = true
2525
ream-bls.workspace = true
2626
ream-consensus-beacon.workspace = true
2727
ream-consensus-misc.workspace = true
28+
29+
[lints]
30+
workspace = true

crates/common/api_types/common/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ actix-web.workspace = true
1414
alloy-primitives.workspace = true
1515
serde.workspace = true
1616
thiserror.workspace = true
17+
18+
[lints]
19+
workspace = true

crates/common/api_types/lean/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@ ethereum_ssz.workspace = true
1616
ethereum_ssz_derive.workspace = true
1717
serde.workspace = true
1818
serde_json.workspace = true
19+
20+
[lints]
21+
workspace = true

crates/common/chain/beacon/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,6 @@ ream-network-spec.workspace = true
2626
ream-operation-pool.workspace = true
2727
ream-p2p.workspace = true
2828
ream-storage.workspace = true
29+
30+
[lints]
31+
workspace = true

crates/common/chain/lean/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ ream-metrics.workspace = true
2525
ream-network-spec.workspace = true
2626
ream-storage.workspace = true
2727
ream-sync.workspace = true
28+
29+
[lints]
30+
workspace = true

0 commit comments

Comments
 (0)