Skip to content

Commit

Permalink
fix linter
Browse files Browse the repository at this point in the history
  • Loading branch information
beer-1 committed Sep 5, 2024
1 parent c4dbbc4 commit a37d670
Show file tree
Hide file tree
Showing 118 changed files with 23,395 additions and 34,160 deletions.
37 changes: 18 additions & 19 deletions crates/json/src/move_to_json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,29 +170,28 @@ fn convert_decimal_to_json_value(val: &MoveValue) -> VMResult<JSONValue> {
let num = BigUint::from_bytes_le(&num.to_le_bytes());
BigDecimal::new(num.into(), 18)
}
MoveValue::Struct(st) => match st {
MoveValue::Struct(
MoveStruct::WithTypes { type_: _, fields }
| MoveStruct::WithFields(fields)
| MoveStruct::WithVariantFields(_, _, fields) => {
let (_, bytes_val) = fields.get(0).unwrap();
match bytes_val {
MoveValue::Vector(bytes_val) => {
let bytes_le = bytes_val
.iter()
.map(|byte_val| match byte_val {
MoveValue::U8(byte) => *byte,
_ => unreachable!(),
})
.collect::<Vec<u8>>();

let num = BigUint::from_bytes_le(&bytes_le);
BigDecimal::new(num.into(), 18)
}
_ => unreachable!(),
| MoveStruct::WithVariantFields(_, _, fields),
) => {
let (_, bytes_val) = fields.first().unwrap();
match bytes_val {
MoveValue::Vector(bytes_val) => {
let bytes_le = bytes_val
.iter()
.map(|byte_val| match byte_val {
MoveValue::U8(byte) => *byte,
_ => unreachable!(),
})
.collect::<Vec<u8>>();

let num = BigUint::from_bytes_le(&bytes_le);
BigDecimal::new(num.into(), 18)
}
_ => unreachable!(),
}
_ => unreachable!(),
},
}
_ => unreachable!(),
}
.normalized()
Expand Down
Loading

0 comments on commit a37d670

Please sign in to comment.