1- use errors:: * ;
1+ use crate :: errors:: * ;
22use parity_wasm:: elements:: {
33 CodeSection , ElementSection , ExportSection , FuncBody , Instruction , Instructions , Internal ,
44 Module ,
@@ -12,8 +12,8 @@ fn shift_function_ids_in_code_section(
1212 for code_body in code_bodies. iter_mut ( ) {
1313 let opcodes = code_body. code_mut ( ) . elements_mut ( ) ;
1414 for opcode in opcodes. iter_mut ( ) {
15- if let Instruction :: Call ( ref mut function_id) = opcode {
16- * function_id = * function_id + shift
15+ if let Instruction :: Call ( function_id) = * opcode {
16+ * opcode = Instruction :: Call ( function_id + shift)
1717 }
1818 }
1919 }
@@ -23,8 +23,8 @@ fn shift_function_ids_in_code_section(
2323fn shift_function_ids_in_exports_section ( export_section : & mut ExportSection , shift : u32 ) {
2424 for entry in export_section. entries_mut ( ) {
2525 let internal = entry. internal_mut ( ) ;
26- if let Internal :: Function ( ref mut function_id) = internal {
27- * function_id = * function_id + shift
26+ if let Internal :: Function ( function_id) = * internal {
27+ * internal = Internal :: Function ( function_id + shift)
2828 }
2929 }
3030}
@@ -53,9 +53,9 @@ fn replace_function_id_in_code_section(code_section: &mut CodeSection, before: u
5353 for code_body in code_bodies. iter_mut ( ) {
5454 let opcodes = code_body. code_mut ( ) . elements_mut ( ) ;
5555 for opcode in opcodes. iter_mut ( ) {
56- match opcode {
57- Instruction :: Call ( ref mut function_id) if * function_id == before => {
58- * function_id = after
56+ match * opcode {
57+ Instruction :: Call ( function_id) if function_id == before => {
58+ * opcode = Instruction :: Call ( after)
5959 }
6060 _ => { }
6161 }
0 commit comments