Skip to content

Commit

Permalink
Merge pull request #23 from invariant-labs/add-lint-error-for-unused-…
Browse files Browse the repository at this point in the history
…results

add lint error for unused result
  • Loading branch information
none00y authored May 10, 2024
2 parents 3788825 + beefb2e commit 687df8f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ jobs:
uses: actions/checkout@v2
- name: Build and test with Rust latest
run: |
cargo build --verbose
cargo test --verbose
cargo build --verbose --features strict
cargo test --verbose --features strict
rust-nightly:
runs-on: ubuntu-latest
Expand All @@ -28,5 +28,5 @@ jobs:
uses: actions/checkout@v2
- name: Build and test with Rust nightly
run: |
cargo build --verbose
cargo test --verbose
cargo build --verbose --features strict
cargo test --verbose --features strict
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@ jupiter = { git = "https://github.com/jup-ag/rust-amm-implementation.git", branc
invariant-types = { git = "https://github.com/invariant-labs/protocol.git", branch = "master" }
anchor-lang = "0.26.0"
borsh = {version = "*", features = ["const-generics"]}
rust_decimal = "1.30.0"
rust_decimal = "1.30.0"

[features]
strict = []
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![cfg_attr(feature = "strict", deny(unused_results))]

use std::collections::HashMap;

use anchor_lang::prelude::*;
Expand Down
2 changes: 1 addition & 1 deletion src/utiles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl JupiterInvariant {
.enumerate()
.fold(HashMap::new(), |mut m, (index, account)| {
if let Some(account) = account {
m.insert(accounts_to_update[index], account.data.clone());
let _ = m.insert(accounts_to_update[index], account.data.clone());
}
m
})
Expand Down

0 comments on commit 687df8f

Please sign in to comment.