Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove unused bytes_to_hex #942

Merged
merged 1 commit into from
Aug 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 1 addition & 22 deletions engine-types/src/types/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{str, vec, String, Vec, U256};
use crate::{str, vec, Vec, U256};
use borsh::{BorshDeserialize, BorshSerialize};

pub mod address;
Expand Down Expand Up @@ -96,19 +96,6 @@ pub struct FtResolveTransferResult {
pub refund_amount: Balance,
}

const HEX_ALPHABET: &[u8; 16] = b"0123456789abcdef";

#[allow(dead_code)]
#[must_use]
pub fn bytes_to_hex(v: &[u8]) -> String {
let mut result = String::new();
for x in v {
result.push(char::from(HEX_ALPHABET[usize::from(x / 16)]));
result.push(char::from(HEX_ALPHABET[usize::from(x % 16)]));
}
result
}

#[derive(Default)]
pub struct Stack<T> {
stack: Vec<T>,
Expand Down Expand Up @@ -157,14 +144,6 @@ pub fn str_from_slice(inp: &[u8]) -> &str {
mod tests {
use super::*;

#[test]
fn test_hex() {
assert_eq!(
bytes_to_hex(&[0u8, 1u8, 255u8, 16u8]),
"0001ff10".to_string()
);
}

/// Build view of the stack. Intervals between None values are scopes.
fn view_stack(stack: &Stack<i32>) -> Vec<Option<i32>> {
let mut res = vec![];
Expand Down
Loading