From 631ba13566fcbea6c684f391143a08747c9cd5e8 Mon Sep 17 00:00:00 2001 From: "r@l" Date: Tue, 24 Mar 2026 11:27:48 +0100 Subject: [PATCH] Fix clippy warnings across all source files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Remove unused imports: `error` and `self` (fuzzer.rs), `process` and `fuels::types::output` (rustsdk.rs), `info` (rustsdk.rs, sampler.rs, sway.rs, sway_converter.rs, ts_converter.rs, tssdk.rs) * Replace `len() == 0` with `is_empty()` (fuzzer.rs, clippy::len_zero) * Remove unnecessary parentheses around closure bodies (sampler.rs, clippy::unused_parens) All changes are behavior-preserving — resolves all 12 clippy warnings. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/fuzzer.rs | 8 ++++---- src/rustsdk.rs | 5 ++--- src/sampler.rs | 6 +++--- src/sway.rs | 2 +- src/sway_converter.rs | 2 +- src/ts_converter.rs | 2 +- src/tssdk.rs | 2 +- 7 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/fuzzer.rs b/src/fuzzer.rs index 15cddfb..c65a3aa 100644 --- a/src/fuzzer.rs +++ b/src/fuzzer.rs @@ -6,9 +6,9 @@ use std::{ use fuels::types::{param_types::ParamType, Token}; use serde::{Deserialize, Serialize}; -use tracing::{debug, error, info, warn}; +use tracing::{debug, info, warn}; -use crate::{rustsdk::{self, RustSDK}, sampler::Sampler, sway::Sway, tssdk::Ts}; +use crate::{rustsdk::RustSDK, sampler::Sampler, sway::Sway, tssdk::Ts}; pub struct Fuzzer { sampler: Sampler, @@ -72,7 +72,7 @@ impl Fuzzer { decodings: Vec, dir: String, ) { - if decodings.len() == 0 { + if decodings.is_empty() { // No decodings generated return; } @@ -163,7 +163,7 @@ impl Fuzzer { self.check_decodings(&samples, reduced_sway_decodings, "sway".to_string()); self.check_decodings(&samples, ts_decodings, "ts".to_string()); - if sway_encodings.len() == 0 || rust_encodings.len() == 0 || ts_encodings.len() == 0 { + if sway_encodings.is_empty() || rust_encodings.is_empty() || ts_encodings.is_empty() { warn!("Failed to generate encodings for all 3 languages, please consult the output logs for more information."); self.round += 1; // NOTE maybe do binary search to find the failing ParamType/Token that compiles diff --git a/src/rustsdk.rs b/src/rustsdk.rs index 36ddb6a..437334f 100644 --- a/src/rustsdk.rs +++ b/src/rustsdk.rs @@ -1,11 +1,10 @@ use std::io::Write; -use std::{fs, process}; +use std::fs; use std::time::{SystemTime, UNIX_EPOCH}; use fuels::core::codec::{ABIDecoder, ABIEncoder}; -use fuels::types::output; use fuels::types::{param_types::ParamType, Token}; -use tracing::{debug, info, warn}; +use tracing::{debug, warn}; use crate::{error::ABIProbeError, Encoding}; diff --git a/src/sampler.rs b/src/sampler.rs index 87ac3e0..5341631 100644 --- a/src/sampler.rs +++ b/src/sampler.rs @@ -3,7 +3,7 @@ use fuels::types::{ StaticStringToken, Token, U256, }; use rand::{rngs::StdRng, Rng, SeedableRng}; -use tracing::{debug, info}; +use tracing::debug; const NUM_PRIMITIVE_TYPES: usize = 12; const NUM_COMPOUND_TYPES: usize = 4; @@ -208,7 +208,7 @@ impl Sampler { let fields_names: Vec = fields_types .iter() .enumerate() - .map(|(i, _param_type)| (format!("field{}", i + 1))) + .map(|(i, _param_type)| format!("field{}", i + 1)) .collect(); let fields: Vec<(String, ParamType)> = fields_names .into_iter() @@ -230,7 +230,7 @@ impl Sampler { let enum_field_names: Vec<_> = enum_types .iter() .enumerate() - .map(|(i, _param_type)| (format!("Variant{}", i + 1))) + .map(|(i, _param_type)| format!("Variant{}", i + 1)) .collect(); let enum_fields = enum_field_names diff --git a/src/sway.rs b/src/sway.rs index 319e55e..9bd378f 100644 --- a/src/sway.rs +++ b/src/sway.rs @@ -14,7 +14,7 @@ use fuels::{ types::{param_types::ParamType, RawSlice, Token}, }; use tokio::runtime::Runtime; -use tracing::{info, debug, warn}; +use tracing::{debug, warn}; const OUTPUT_PATH: &str = "./forc_project/src/main.sw"; const SWAY_COMPILATION_FAIL: &str = "Failed to compile"; diff --git a/src/sway_converter.rs b/src/sway_converter.rs index 81874de..fe7ccd3 100644 --- a/src/sway_converter.rs +++ b/src/sway_converter.rs @@ -1,6 +1,6 @@ use fuels::types::{param_types::ParamType, Token}; use std::vec; -use tracing::{debug, info}; +use tracing::debug; pub struct SwayConverter { vector_counter: usize, diff --git a/src/ts_converter.rs b/src/ts_converter.rs index fec5ad5..c714eed 100644 --- a/src/ts_converter.rs +++ b/src/ts_converter.rs @@ -1,5 +1,5 @@ use fuels::types::{param_types::ParamType, Token}; -use tracing::{debug, info}; +use tracing::debug; const CUSTOM_TYPES: &str = "{custom_types}"; const TESTCASES: &str = "{testcases}"; diff --git a/src/tssdk.rs b/src/tssdk.rs index 468868f..388f793 100644 --- a/src/tssdk.rs +++ b/src/tssdk.rs @@ -6,7 +6,7 @@ use std::{ }; use fuels::types::{param_types::ParamType, Token}; -use tracing::{debug, info, warn}; +use tracing::{debug, warn}; use crate::{error::ABIProbeError, ts_converter::TSConverter, Encoding};