Skip to content

Commit 982b404

Browse files
VictorLuxclaude
andcommitted
fix: Resolve 4 Rust 1.93.0 Clippy lints in zipherx-ffi
- Collapse nested if statements for tor-only mode checks - Use inspect_err instead of map_err returning unchanged error - Allow empty_line_after_doc_comments for UniFFI generated code Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f5aa34d commit 982b404

1 file changed

Lines changed: 14 additions & 16 deletions

File tree

crates/zipherx-ffi/src/lib.rs

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Suppress lint on UniFFI-generated code (empty lines after doc comments in scaffolding).
2+
#![allow(clippy::empty_line_after_doc_comments)]
3+
14
//! ZipherX FFI bindings — UniFFI interface for cross-platform access.
25
//!
36
//! This crate generates native bindings for:
@@ -787,14 +790,12 @@ static SYNC_TASK: Mutex<Option<tokio::task::JoinHandle<()>>> = Mutex::new(None);
787790
fn start_sync(callback: Box<dyn SyncProgressCallback>) -> Result<(), WalletError> {
788791
// RF-18: When TOR_ONLY_MODE is enabled, verify Tor is ready before any
789792
// network operation. Prevents boost download and sync from bypassing Tor.
790-
if zipherx_tor::client::is_tor_only_mode() {
791-
if !zipherx_tor::client::is_socks_running() {
792-
return Err(WalletError::NetworkError {
793-
msg: "Tor-only mode is enabled but Tor SOCKS5 proxy is not running. \
794-
Start Tor before syncing."
795-
.into(),
796-
});
797-
}
793+
if zipherx_tor::client::is_tor_only_mode() && !zipherx_tor::client::is_socks_running() {
794+
return Err(WalletError::NetworkError {
795+
msg: "Tor-only mode is enabled but Tor SOCKS5 proxy is not running. \
796+
Start Tor before syncing."
797+
.into(),
798+
});
798799
}
799800

800801
let wallet = get_wallet()?;
@@ -1269,12 +1270,10 @@ fn send_with_progress(
12691270
}
12701271

12711272
// Finding 4: Verify Tor proxy when tor-only mode is active
1272-
if zipherx_tor::client::is_tor_only_mode() {
1273-
if !zipherx_tor::client::is_socks_running() {
1274-
return Err(WalletError::NetworkError {
1275-
msg: "Tor-only mode enabled but Tor SOCKS5 proxy is not running".into(),
1276-
});
1277-
}
1273+
if zipherx_tor::client::is_tor_only_mode() && !zipherx_tor::client::is_socks_running() {
1274+
return Err(WalletError::NetworkError {
1275+
msg: "Tor-only mode enabled but Tor SOCKS5 proxy is not running".into(),
1276+
});
12781277
}
12791278

12801279
// RF-12: Concurrency guard — prevent overlapping sends
@@ -1294,9 +1293,8 @@ fn send_with_progress(
12941293
}
12951294
}
12961295

1297-
let wallet = get_wallet().map_err(|e| {
1296+
let wallet = get_wallet().inspect_err(|_| {
12981297
IS_SENDING.store(false, Ordering::SeqCst);
1299-
e
13001298
})?;
13011299
let callback = Arc::new(callback);
13021300

0 commit comments

Comments
 (0)