Skip to content

Commit

Permalink
refactor: simplify an instance of a Result combinator
Browse files Browse the repository at this point in the history
  • Loading branch information
huitseeker committed May 13, 2022
1 parent 834dc5b commit c1979b0
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions sui_core/src/sui_json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,14 +214,13 @@ fn resolve_primtive_arg(
let move_type_layout = make_prim_move_type_layout(param)?;
// Check that the args are what we expect or can be converted
// Then return the serialized bcs value
match arg.to_bcs_bytes(&move_type_layout) {
Ok(a) => Ok(a),
Err(e) => Err(anyhow!(
arg.to_bcs_bytes(&move_type_layout).map_err(|e| {
anyhow!(
"Unable to parse arg at type {}. Got error: {:?}",
move_type_layout,
e
)),
}
)
})
}

fn make_prim_move_type_layout(param: &SignatureToken) -> Result<MoveTypeLayout, anyhow::Error> {
Expand Down

0 comments on commit c1979b0

Please sign in to comment.