Skip to content

Commit 1233092

Browse files
scarmuegaclaude
andcommitted
chore: clear clippy lints for green CI
`cargo clippy -- -D warnings` (the CI gate) was failing on pre-existing warnings. Fixes: - drop unused imports (search, tx/common) and the never-constructed `UTxORPCParameters` struct (+ its now-orphaned serde import) - collapse inner `if`s into match guards in the explorer key handlers (the catch-all arm is a no-op `_ => {}`, so behavior is unchanged) - redundant closure → method reference; drop a needless `Ok(..?)` No behavior change. `cargo clippy -- -D warnings` and `cargo test` green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 2940081 commit 1233092

5 files changed

Lines changed: 25 additions & 45 deletions

File tree

src/explorer/widgets/tabs/accounts.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,13 @@ pub struct AccountsTabState {
2121
impl AccountsTabState {
2222
pub fn handle_key(&mut self, key: &KeyEvent) {
2323
match (key.code, key.modifiers) {
24-
(KeyCode::Char('l') | KeyCode::Right, _) => {
25-
if self.list_state.selected().is_some() {
26-
self.focus_on_table = true;
27-
self.table_state.select_next();
28-
}
24+
(KeyCode::Char('l') | KeyCode::Right, _) if self.list_state.selected().is_some() => {
25+
self.focus_on_table = true;
26+
self.table_state.select_next();
2927
}
30-
(KeyCode::Char('h') | KeyCode::Left, _) => {
31-
if self.focus_on_table {
32-
self.focus_on_table = false;
33-
self.table_state.select(None);
34-
}
28+
(KeyCode::Char('h') | KeyCode::Left, _) if self.focus_on_table => {
29+
self.focus_on_table = false;
30+
self.table_state.select(None);
3531
}
3632
(KeyCode::Char('j') | KeyCode::Down, _) => {
3733
if self.focus_on_table {

src/explorer/widgets/tabs/transactions.rs

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -68,24 +68,20 @@ impl TransactionsTabState {
6868
(KeyCode::Char('f') | KeyCode::Char('/'), _) => {
6969
self.input_mode = InputMode::Editing
7070
}
71-
(KeyCode::Esc, _) => {
72-
if !self.search_input.is_empty() {
73-
self.search_input.clear();
74-
self.txs = self
75-
.blocks
76-
.borrow()
77-
.iter()
78-
.flat_map(TxView::from_chain_block)
79-
.collect();
80-
}
71+
(KeyCode::Esc, _) if !self.search_input.is_empty() => {
72+
self.search_input.clear();
73+
self.txs = self
74+
.blocks
75+
.borrow()
76+
.iter()
77+
.flat_map(TxView::from_chain_block)
78+
.collect();
8179
}
82-
(KeyCode::Enter, _) => {
83-
if self.table_state.selected().is_some() {
84-
self.detail_state.tree_state.close_all();
85-
self.detail_state.tree_state.select_first();
86-
self.view_mode = ViewMode::Detail;
87-
self.tx_selected = None;
88-
}
80+
(KeyCode::Enter, _) if self.table_state.selected().is_some() => {
81+
self.detail_state.tree_state.close_all();
82+
self.detail_state.tree_state.select_first();
83+
self.view_mode = ViewMode::Detail;
84+
self.tx_selected = None;
8985
}
9086
_ => {}
9187
},

src/provider/create.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use serde::{Deserialize, Serialize};
21
use std::collections::HashMap;
32

43
use anyhow::{bail, Result};
@@ -13,12 +12,6 @@ enum NetworkKind {
1312
Testnet,
1413
}
1514

16-
#[derive(Serialize, Deserialize)]
17-
struct UTxORPCParameters {
18-
url: String,
19-
headers: HashMap<String, String>,
20-
}
21-
2215
#[derive(Parser, Clone)]
2316
pub struct Args {
2417
/// Name to identify the provider.

src/search/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use anyhow::Result;
2-
use clap::{command, Parser, Subcommand};
2+
use clap::{Parser, Subcommand};
33
use comfy_table::Table;
44
use tracing::instrument;
55
use utxorpc::{
@@ -52,7 +52,7 @@ fn cardano_tx_table(block_hash: Option<Vec<u8>>, tx: &[Tx]) -> Table {
5252
]);
5353

5454
let block_hash = block_hash
55-
.map(|b| hex::encode(b))
55+
.map(hex::encode)
5656
.map(|x| format!("{}...{}", &x[..4], &x[x.len() - 4..]))
5757
.unwrap_or_default();
5858

src/tx/common.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,10 @@ use anyhow::{bail, Context as _, Result};
22
use inquire::{Confirm, MultiSelect};
33
use pallas::ledger::addresses::Address;
44
use serde_json::{json, Value};
5-
use std::{
6-
collections::{BTreeMap, HashMap},
7-
path::Path,
8-
};
5+
use std::path::Path;
96

107
use tx3_sdk::{
11-
core::ArgMap,
12-
tii::{Invocation, ParamMap, ParamType},
8+
tii::{Invocation, ParamType},
139
trp::TxEnvelope,
1410
};
1511

@@ -74,7 +70,7 @@ fn inquire_custom_address(param_key: &str) -> Result<Address> {
7470
.with_help_message("Enter a bech32 address")
7571
.prompt()?;
7672

77-
Ok(Address::from_bech32(&value).context("invalid bech32 address")?)
73+
Address::from_bech32(&value).context("invalid bech32 address")
7874
}
7975

8076
fn inquire_address(ctx: &crate::Context, provider: &Provider, param_key: &str) -> Result<Address> {
@@ -274,8 +270,7 @@ mod tests {
274270
#[test]
275271
fn invoke_encodes_diverse_args_into_resolve_request() {
276272
let tii = format!("{}/tests/fixtures/invoke.tii", env!("CARGO_MANIFEST_DIR"));
277-
let mut invocation =
278-
prepare_invocation(Path::new(&tii), Some("transfer"), None).unwrap();
273+
let mut invocation = prepare_invocation(Path::new(&tii), Some("transfer"), None).unwrap();
279274

280275
let args_json = r#"{
281276
"quantity": 2000000,

0 commit comments

Comments
 (0)