|
1 | 1 | use std::collections::{BTreeMap, BTreeSet}; |
2 | 2 |
|
3 | | -use tracing::{debug, warn}; |
4 | 3 | use movy_types::{ |
5 | 4 | abi::MoveFunctionAbi, |
6 | 5 | input::{ |
7 | 6 | FunctionIdent, MoveCall, MoveSequence, MoveSequenceCall, MoveTypeTag, SequenceArgument, |
8 | 7 | }, |
9 | 8 | }; |
| 9 | +use tracing::{debug, warn}; |
10 | 10 |
|
11 | 11 | use crate::{ |
12 | 12 | meta::{FunctionHook, FuzzMetadata, HasFuzzMetadata}, |
@@ -105,14 +105,13 @@ fn append_hook_call<S>( |
105 | 105 | let mut fixed_args: BTreeMap<u16, (SequenceArgument, MoveTypeTag)> = BTreeMap::new(); |
106 | 106 | let mut fixed_ty_args: BTreeMap<u16, MoveTypeTag> = BTreeMap::new(); |
107 | 107 | let param_offset = if ctx_arg.is_some() { 1 } else { 0 }; |
108 | | - if let Some(ctx) = ctx_arg { |
109 | | - if let Some(param_ty) = hook_abi |
| 108 | + if let Some(ctx) = ctx_arg |
| 109 | + && let Some(param_ty) = hook_abi |
110 | 110 | .parameters |
111 | | - .get(0) |
| 111 | + .first() |
112 | 112 | .and_then(|p| p.subst(&BTreeMap::new())) |
113 | | - { |
114 | | - fixed_args.insert(0, (ctx, param_ty)); |
115 | | - } |
| 113 | + { |
| 114 | + fixed_args.insert(0, (ctx, param_ty)); |
116 | 115 | } |
117 | 116 | if let Some((target_call, target_abi, _maybe_idx)) = target { |
118 | 117 | // Hook must mirror the target function signature (plus optional context). |
@@ -179,7 +178,7 @@ fn append_hook_call<S>( |
179 | 178 | .arguments |
180 | 179 | .get(i) |
181 | 180 | .cloned() |
182 | | - .unwrap_or_else(|| SequenceArgument::Input(0)); |
| 181 | + .unwrap_or(SequenceArgument::Input(0)); |
183 | 182 | fixed_args.insert((param_offset + i) as u16, (arg, hook_ty)); |
184 | 183 | } |
185 | 184 | } |
|
0 commit comments