Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

Commit

Permalink
replace unwraps with expects
Browse files Browse the repository at this point in the history
  • Loading branch information
lostman committed Nov 22, 2023
1 parent 16144e0 commit e0ec0e2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/fuel-indexer-plugin/src/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ pub trait Entity<'a>: Sized + PartialEq + Eq + std::fmt::Debug {

fn find_many(query: impl ToFilter<Self>, limit: Option<usize>) -> Vec<Self> {
unsafe {
let buff = bincode::serialize(&query.to_filter()).unwrap();
let buff = bincode::serialize(&query.to_filter()).expect("Failed to serialize query");
let mut bufflen = (buff.len() as u32).to_le_bytes();

let ptr = ff_find_many(
Expand All @@ -148,9 +148,9 @@ pub trait Entity<'a>: Sized + PartialEq + Eq + std::fmt::Debug {
if !ptr.is_null() {
let len = u32::from_le_bytes(bufflen) as usize;
let bytes = Vec::from_raw_parts(ptr, len, len);
let data: Vec<Vec<u8>> = deserialize(&bytes).unwrap();
let data: Vec<Vec<u8>> = deserialize(&bytes).expect("Failed to deserialize data");
data.iter()
.map(|x| Self::from_row(deserialize(x).unwrap()))
.map(|x| Self::from_row(deserialize(x).expect("Failed to deserialize data")))
.collect()
} else {
vec![]
Expand Down

0 comments on commit e0ec0e2

Please sign in to comment.