Skip to content

Commit

Permalink
Apply cargo-clippy fix
Browse files Browse the repository at this point in the history
  • Loading branch information
eval-exec committed Sep 18, 2024
1 parent 5056495 commit 0496458
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 14 deletions.
10 changes: 5 additions & 5 deletions src/tests/omni_lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ fn test_omnilock_simple_hash_rc_input(mut cfg: OmniLockConfig) {
cfg.set_admin_config(admin_config);

let sender = build_omnilock_script(&cfg);
for (lock, capacity_opt) in vec![(sender.clone(), Some(100 * ONE_CKB))] {
for (lock, capacity_opt) in [(sender.clone(), Some(100 * ONE_CKB))] {
ctx.add_simple_live_cell(random_out_point(), lock, capacity_opt);
}

Expand Down Expand Up @@ -407,7 +407,7 @@ fn test_omnilock_simple_hash_rc(mut cfg: OmniLockConfig, unlock_mode: OmniUnlock
OmniUnlockMode::Normal => (None, 0),
};
let sender = build_omnilock_script(&cfg);
for (lock, capacity_opt) in vec![(sender.clone(), Some(300 * ONE_CKB))] {
for (lock, capacity_opt) in [(sender.clone(), Some(300 * ONE_CKB))] {
ctx.add_simple_live_cell(random_out_point(), lock, capacity_opt);
}

Expand Down Expand Up @@ -517,7 +517,7 @@ fn test_omnilock_simple_hash_rc2(mut cfg: OmniLockConfig) {
cfg.set_admin_config(admin_config);

let sender = build_omnilock_script(&cfg);
for (lock, capacity_opt) in vec![(sender.clone(), Some(300 * ONE_CKB))] {
for (lock, capacity_opt) in [(sender.clone(), Some(300 * ONE_CKB))] {
ctx.add_simple_live_cell(random_out_point(), lock, capacity_opt);
}

Expand Down Expand Up @@ -686,7 +686,7 @@ fn test_omnilock_transfer_from_multisig_wl_commnon(unlock_mode: OmniUnlockMode)
false,
));
let sender = build_omnilock_script(&cfg);
for (lock, capacity_opt) in vec![
for (lock, capacity_opt) in [
(sender.clone(), Some(100 * ONE_CKB)),
(sender.clone(), Some(200 * ONE_CKB)),
(sender.clone(), Some(300 * ONE_CKB)),
Expand Down Expand Up @@ -874,7 +874,7 @@ fn test_omnilock_transfer_from_ownerlock_wl_admin() {
false,
));
let sender0 = build_omnilock_script(&cfg);
for (lock, capacity_opt) in vec![(sender0.clone(), Some(50 * ONE_CKB))] {
for (lock, capacity_opt) in [(sender0.clone(), Some(50 * ONE_CKB))] {
ctx.add_simple_live_cell(random_out_point(), lock, capacity_opt);
}

Expand Down
2 changes: 1 addition & 1 deletion src/tests/omni_lock_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ fn build_script(
always_success.as_builder().args(hash.pack()).build()
} else {
// this args can be anything
let args = vec![0u8; 32];
let args: &[u8] = &[0u8; 32];
Script::new_builder()
.args(args.pack())
.code_hash(hash.pack())
Expand Down
2 changes: 1 addition & 1 deletion src/traits/default_impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ impl DefaultCellDepResolver {
.map(|(tx_index, tx)| {
tx.outputs()
.into_iter()
.zip(tx.outputs_data().into_iter())
.zip(tx.outputs_data())
.enumerate()
.map(|(index, (output, data))| {
if tx_index == SIGHASH_OUTPUT_LOC.0 && index == SIGHASH_OUTPUT_LOC.1 {
Expand Down
7 changes: 1 addition & 6 deletions src/tx_builder/dao.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,12 +358,7 @@ impl TxBuilder for DaoWithdrawBuilder {
inputs.push(input);
witnesses.push(witness.pack());
}
header_deps.extend(
prepare_block_hashes
.into_iter()
.collect::<HashSet<_>>()
.into_iter(),
);
header_deps.extend(prepare_block_hashes.into_iter().collect::<HashSet<_>>());

let (outputs, outputs_data) = match &self.receiver {
DaoWithdrawReceiver::LockScript { script, fee_rate } => {
Expand Down
2 changes: 1 addition & 1 deletion src/types/script_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl ScriptId {
Script::new_builder()
.code_hash(self.code_hash.pack())
.hash_type(self.hash_type.into())
.args(vec![0u8; 32].pack())
.args(<[u8]>::pack(&[0u8; 32]))
.build()
}
}
Expand Down

0 comments on commit 0496458

Please sign in to comment.