Skip to content

Commit

Permalink
fix: import vec and string from alloc
Browse files Browse the repository at this point in the history
  • Loading branch information
glihm committed Dec 10, 2023
1 parent dd23610 commit 955820f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions starknet-core/src/types/byte_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
//! with the Cairo implementation.
use alloc::{
str::{self},
string::FromUtf8Error,
string::{FromUtf8Error, String},
vec::Vec,
};

use starknet_ff::FieldElement;
Expand Down Expand Up @@ -60,7 +61,7 @@ impl ByteArray {
(FieldElement::ZERO, 0)
};

let mut data = vec![];
let mut data = Vec::new();
for chunk in full_chunks {
// Safe to unwrap as full chunks are 31 bytes long, always fit in a felt.
data.push(FieldElement::from_byte_slice_be(chunk).unwrap())
Expand Down Expand Up @@ -102,7 +103,7 @@ impl ByteArray {
/// of `ByteArray`, we don't need to check `len` as the `MAX_WORD_LEN`
/// already protect against that.
fn felt_to_utf8(felt: &FieldElement, len: usize) -> Result<String, FromUtf8Error> {
let mut buffer = vec![];
let mut buffer = Vec::new();

// ByteArray always enforce to have the first byte equal to 0.
// That's why we start to 1.
Expand Down

0 comments on commit 955820f

Please sign in to comment.