Skip to content

Commit 2112078

Browse files
sdbondiclaude
andcommitted
ci: add clippy lint check for examples and fix existing warnings
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ffa7e74 commit 2112078

File tree

2 files changed

+30
-5
lines changed

2 files changed

+30
-5
lines changed

.github/workflows/ci.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,31 @@ env:
99
CARGO_TERM_COLOR: always
1010

1111
jobs:
12+
lint-examples:
13+
name: Lint Examples
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- uses: dtolnay/rust-toolchain@stable
19+
with:
20+
components: clippy
21+
targets: wasm32-unknown-unknown
22+
23+
- uses: Swatinem/rust-cache@v2
24+
with:
25+
workspaces: |
26+
examples/guessing_game/template
27+
examples/guessing_game/cli
28+
29+
- name: Clippy (template - wasm)
30+
working-directory: examples/guessing_game/template
31+
run: cargo clippy --target wasm32-unknown-unknown -- -D warnings
32+
33+
- name: Clippy (cli)
34+
working-directory: examples/guessing_game/cli
35+
run: cargo clippy -- -D warnings
36+
1237
test-templates:
1338
name: Test Templates
1439
runs-on: ubuntu-latest

examples/guessing_game/cli/src/main.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use tari_ootle_common_types::{Network, engine_types::transaction_receipt::Transa
2020
use tari_ootle_transaction::{TransactionBuilder, args};
2121
use tari_template_lib_types::{
2222
ComponentAddress, NonFungibleAddress, NonFungibleId, ResourceAddress, TemplateAddress,
23-
constants::{TARI, TARI_TOKEN},
23+
constants::{ TARI_TOKEN},
2424
};
2525
use tari_utilities::{ByteArray, hex::Hex};
2626

@@ -357,7 +357,7 @@ async fn cmd_init(state_path: &Path, state: &mut State) -> anyhow::Result<()> {
357357
println!(" 🏦 Account component: {account_addr}");
358358

359359
let unsigned_tx = IFaucet::new(&provider)
360-
.take_faucet_funds(10 * TARI)
360+
.take_faucet_funds()
361361
.pay_fee(500u64)
362362
.prepare()
363363
.await?;
@@ -663,7 +663,7 @@ async fn create_user(
663663
state: &mut State,
664664
name_arg: Option<String>,
665665
) -> anyhow::Result<()> {
666-
let name = name_arg.unwrap_or_else(|| generate_name());
666+
let name = name_arg.unwrap_or_else(generate_name);
667667
let network = parse_network(&state.network)?;
668668
let secret = OotleSecretKey::random(network);
669669
let wallet = OotleWallet::from(PrivateKeyProvider::new(secret.clone()));
@@ -679,7 +679,7 @@ async fn create_user(
679679
println!("👤 Creating user '{name}' with account address {account_address}...");
680680

681681
let unsigned_tx = IFaucet::new(&provider)
682-
.take_faucet_funds(10 * TARI)
682+
.take_faucet_funds()
683683
.pay_fee(500u64)
684684
.prepare()
685685
.await?;
@@ -787,7 +787,7 @@ async fn cmd_end_game(state: &mut State) -> anyhow::Result<()> {
787787
}
788788
println!(
789789
"🏆 The number was {}.",
790-
number.unwrap_or_else(|| "unknown?")
790+
number.unwrap_or("unknown?")
791791
);
792792
println!("🏆 Round ended.");
793793

0 commit comments

Comments
 (0)