Skip to content

Commit

Permalink
clippy in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dorin-iancu committed Dec 2, 2024
1 parent aaee2cc commit dd58d66
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions dex/fuzz/src/fuzz_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,12 +401,12 @@ pub mod fuzz_data_tests {

let timestamp_oracle_wrapper = blockchain_wrapper.create_sc_account(
&rust_zero,
Some(&owner_addr),
Some(owner_addr),
timestamp_oracle::contract_obj,
"timestamp oracle",
);
blockchain_wrapper
.execute_tx(&owner_addr, &timestamp_oracle_wrapper, &rust_zero, |sc| {
.execute_tx(owner_addr, &timestamp_oracle_wrapper, &rust_zero, |sc| {
sc.init(0);

for i in 0..=21 {
Expand Down
6 changes: 3 additions & 3 deletions dex/fuzz/src/fuzz_farm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub mod fuzz_farm_test {

//randomly add all existing farm positions for merge
let merge_farm_positions: bool = fuzzer_data.rng.gen();
if merge_farm_positions && farm_setup.farmer_info.get(&caller.address).is_some() {
if merge_farm_positions && farm_setup.farmer_info.contains_key(&caller.address) {
for farm_token_nonce in farm_setup.farmer_info.get(&caller.address).unwrap().iter() {
let farm_token_amount = fuzzer_data.blockchain_wrapper.get_esdt_balance(
&caller.address,
Expand Down Expand Up @@ -221,7 +221,7 @@ pub mod fuzz_farm_test {
// When claiming rewards, the caller uses all his farming positions
let mut farm_token_amount_check = rust_biguint!(0u64);
let mut payments = Vec::new();
if farm_setup.farmer_info.get(&caller.address).is_some() {
if farm_setup.farmer_info.contains_key(&caller.address) {
for farm_token_nonce in farm_setup.farmer_info.get(&caller.address).unwrap().iter() {
let farm_token_amount = fuzzer_data.blockchain_wrapper.get_esdt_balance(
&caller.address,
Expand Down Expand Up @@ -320,7 +320,7 @@ pub mod fuzz_farm_test {
// When compounding rewards, the caller uses all his farming positions
let mut farm_token_amount_check = rust_biguint!(0u64);
let mut payments = Vec::new();
if farm_setup.farmer_info.get(&caller.address).is_some() {
if farm_setup.farmer_info.contains_key(&caller.address) {
for farm_token_nonce in farm_setup.farmer_info.get(&caller.address).unwrap().iter() {
let farm_token_amount = fuzzer_data.blockchain_wrapper.get_esdt_balance(
&caller.address,
Expand Down
2 changes: 1 addition & 1 deletion dex/fuzz/src/fuzz_price_discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ pub mod fuzz_price_discovery_test {

if redeem_token_before < redeem_token_amount_in {
if redeem_token_amount_in > rust_zero {
redeem_token_amount_in = redeem_token_before.clone();
redeem_token_amount_in.clone_from(&redeem_token_before);
} else {
println!("Price discovery redeem error: Not enough tokens");
fuzzer_data.statistics.price_discovery_redeem_misses += 1;
Expand Down
2 changes: 1 addition & 1 deletion dex/pair/tests/pair_rs_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1387,7 +1387,7 @@ fn add_liquidity_through_simple_lock_proxy() {
pair_setup.b_mock.set_block_epoch(5);

// add liquidity through simple-lock SC - one locked (WEGLD) token, one unlocked (MEX)
let transfers = vec![
let transfers = [
TxTokenTransfer {
token_identifier: LOCKED_TOKEN_ID.to_vec(),
nonce: 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ fn views_test() {
.b_mock
.execute_query(&setup.proxy_deployer_wrapper, |sc| {
let is_blacklisted = sc.is_user_blacklisted(managed_address!(&user_addr));
assert_eq!(is_blacklisted, false);
assert!(!is_blacklisted);

let addr_for_tok = sc
.get_address_for_token(managed_token_id!(farming_token_id))
Expand Down

0 comments on commit dd58d66

Please sign in to comment.