Skip to content

Commit f95e59e

Browse files
committed
fix: resolve final clippy lint warnings
Test file fixes: - Remove empty line after doc comment in wallet_error_handling.rs - Add #[allow(dead_code)] to unused struct fields in wallet_error_handling.rs - Replace vec! macro with array literal in wallet_error_handling.rs Security audit fixes: - Replace expect with function call with unwrap_or_else in security_logging_audit.rs Code quality fixes: - Add #[allow(clippy::items_after_test_module)] to wallet.rs - Add #[allow(clippy::items_after_test_module)] to config.rs - Replace len() > 0 with is_empty() in soroban.rs (2 occurrences) All 361+ tests passing Clippy lint passes with -D warnings flag All CI checks ready
1 parent d1e7860 commit f95e59e

5 files changed

Lines changed: 9 additions & 5 deletions

File tree

src/commands/wallet.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(clippy::items_after_test_module)]
2+
13
use crate::utils::{
24
config, confirmation, crypto, hardware_wallet, horizon, mnemonic, multisig, print as p,
35
};

src/utils/config.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(clippy::items_after_test_module)]
2+
13
use crate::utils::crypto;
24
use anyhow::{Context, Result};
35
use base64::{engine::general_purpose::STANDARD as BASE64, Engine};

src/utils/soroban.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -865,12 +865,12 @@ mod tests {
865865
fn encode_invalid_int_errors() {
866866
let err =
867867
encode_arguments(&["not_a_number".to_string()], &["int".to_string()]).unwrap_err();
868-
assert!(err.to_string().len() > 0);
868+
assert!(!err.to_string().is_empty());
869869
}
870870

871871
#[test]
872872
fn encode_invalid_bool_errors() {
873873
let err = encode_arguments(&["maybe".to_string()], &["bool".to_string()]).unwrap_err();
874-
assert!(err.to_string().len() > 0);
874+
assert!(!err.to_string().is_empty());
875875
}
876876
}

tests/security_logging_audit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ fn no_sensitive_patterns_are_emitted_at_info_level() {
1414
];
1515

1616
for path in FILES_TO_AUDIT {
17-
let contents = fs::read_to_string(path).expect(&format!("Failed to read {}", path));
17+
let contents = fs::read_to_string(path).unwrap_or_else(|_| panic!("Failed to read {}", path));
1818
for (prefix, sensitive) in patterns {
1919
for (index, line) in contents.lines().enumerate() {
2020
if line.contains(prefix) && line.contains(sensitive) {

tests/wallet_error_handling.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/// Error handling and edge case tests for wallet operations
22
/// Tests failure scenarios, invalid inputs, and error recovery
3-
43
#[cfg(test)]
54
mod wallet_error_handling_tests {
65
const VALID_PUBLIC_KEY: &str = "GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
@@ -9,6 +8,7 @@ mod wallet_error_handling_tests {
98

109
// Mock structures
1110
#[derive(Debug, Clone)]
11+
#[allow(dead_code)]
1212
struct WalletEntry {
1313
name: String,
1414
public_key: String,
@@ -159,7 +159,7 @@ mod wallet_error_handling_tests {
159159
fn test_create_wallet_with_valid_name_characters() {
160160
let mut config = WalletConfig::new();
161161

162-
let valid_names = vec!["alice", "bob-wallet", "charlie_wallet", "dave123"];
162+
let valid_names = ["alice", "bob-wallet", "charlie_wallet", "dave123"];
163163

164164
for (i, name) in valid_names.iter().enumerate() {
165165
let public_key = format!("G{:0>55}", i);

0 commit comments

Comments
 (0)