Skip to content

Commit

Permalink
Remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
leighmcculloch committed Dec 11, 2024
1 parent 39e15b5 commit 5ff1191
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 28 deletions.
18 changes: 1 addition & 17 deletions soroban-sdk/src/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ impl Address {
}
}

#[cfg(any(not(target_family = "wasm"), test, feature = "testutils"))]
#[cfg(any(test, feature = "testutils"))]
use crate::env::xdr::Hash;
use crate::unwrap::UnwrapOptimized;

Expand All @@ -327,19 +327,3 @@ impl crate::testutils::Address for Address {
.unwrap()
}
}

#[cfg(not(target_family = "wasm"))]
impl Address {
pub(crate) fn contract_id(&self) -> Hash {
let sc_address: ScAddress = self.into();
if let ScAddress::Contract(c) = sc_address {
c
} else {
panic!("address is not a contract {:?}", self);
}
}

pub(crate) fn from_contract_id(env: &Env, contract_id: [u8; 32]) -> Self {
Self::try_from_val(env, &ScAddress::Contract(Hash(contract_id))).unwrap()
}
}
6 changes: 5 additions & 1 deletion soroban-sdk/src/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -791,9 +791,13 @@ impl IntoIterator for Bytes {
pub struct BytesIter(Bytes);

impl BytesIter {
fn into_bin(self) -> Bytes {
pub fn into_bytes(self) -> Bytes {
self.0
}

pub fn to_bytes(&self) -> Bytes {
self.0.clone()
}
}

impl Iterator for BytesIter {
Expand Down
3 changes: 0 additions & 3 deletions soroban-sdk/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ use core::fmt::Debug;
use crate::{contracttype, Bytes, Map};
use crate::{env::internal, unwrap::UnwrapInfallible, Env, IntoVal, Val, Vec};

// TODO: consolidate with host::events::TOPIC_BYTES_LENGTH_LIMIT
const TOPIC_BYTES_LENGTH_LIMIT: u32 = 32;

/// Events publishes events for the currently executing contract.
///
/// ```
Expand Down
1 change: 0 additions & 1 deletion soroban-sdk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
#![cfg_attr(target_family = "wasm", no_std)]
#![cfg_attr(feature = "docs", feature(doc_cfg))]
#![allow(dead_code)]
// The SDK uses #[test] in doctests, and does some sneaky line hiding to have
// the doctest execute the test inside a main function instead.
#![allow(clippy::test_attr_in_doctest)]
Expand Down
5 changes: 0 additions & 5 deletions soroban-sdk/src/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,11 +291,6 @@ impl<K, V> Map<K, V> {
self.obj.to_val()
}

#[inline(always)]
pub(crate) fn as_object(&self) -> &MapObject {
&self.obj
}

#[inline(always)]
pub(crate) fn to_object(&self) -> MapObject {
self.obj
Expand Down
6 changes: 5 additions & 1 deletion soroban-sdk/src/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,11 @@ impl<T> VecTryIter<T> {
}
}

fn into_vec(self) -> Vec<T> {
pub fn into_vec(self) -> Vec<T> {
self.to_vec()
}

pub fn to_vec(&self) -> Vec<T> {
self.vec.slice(self.start..self.end)
}
}
Expand Down

0 comments on commit 5ff1191

Please sign in to comment.