Skip to content

Commit

Permalink
feated contract: removing unecessary unwrap
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-pommier-epi committed Feb 1, 2025
1 parent 7621e5c commit 008a765
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/contract_encoding.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use anyhow;
use serde_json::Value;

use crate::contracts::NetworkType;
Expand All @@ -14,19 +13,19 @@ fn _build_debug_bytecode(bytecode: &str, bytecode_patch: &str) -> Result<String,

for parts in pattern.find_iter(bytecode_patch) {
let part = parts.as_str();
let diff_type = part.chars().next().unwrap();
let diff_type = part.chars().next().unwrap_or(' ');

match diff_type {
'=' => {
let length = part[1..].parse::<usize>().unwrap();
let length = part[1..].parse::<usize>()?;
result.push_str(&bytecode[index..index + length]);
index += length;
},
'+' => {
result.push_str(&part[1..]);
},
'-' => {
let length = part[1..].parse::<usize>().unwrap();
let length = part[1..].parse::<usize>()?;
index += length;
},
_ => {},
Expand Down

0 comments on commit 008a765

Please sign in to comment.