From 9ee70afa6687341e174177b981681862ec3f5053 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Wed, 11 Dec 2024 23:16:42 +1000 Subject: [PATCH] Remove dead code --- soroban-sdk/src/bytes.rs | 6 +++++- soroban-sdk/src/events.rs | 3 --- soroban-sdk/src/lib.rs | 1 - soroban-sdk/src/map.rs | 5 ----- soroban-sdk/src/vec.rs | 6 +++++- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/soroban-sdk/src/bytes.rs b/soroban-sdk/src/bytes.rs index 37f1cb55..1b0f65b7 100644 --- a/soroban-sdk/src/bytes.rs +++ b/soroban-sdk/src/bytes.rs @@ -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 { diff --git a/soroban-sdk/src/events.rs b/soroban-sdk/src/events.rs index 6d6e9a98..5a6414b1 100644 --- a/soroban-sdk/src/events.rs +++ b/soroban-sdk/src/events.rs @@ -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. /// /// ``` diff --git a/soroban-sdk/src/lib.rs b/soroban-sdk/src/lib.rs index 4bd940d5..8816756f 100644 --- a/soroban-sdk/src/lib.rs +++ b/soroban-sdk/src/lib.rs @@ -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)] diff --git a/soroban-sdk/src/map.rs b/soroban-sdk/src/map.rs index 2608ab4c..2905778e 100644 --- a/soroban-sdk/src/map.rs +++ b/soroban-sdk/src/map.rs @@ -291,11 +291,6 @@ impl Map { 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 diff --git a/soroban-sdk/src/vec.rs b/soroban-sdk/src/vec.rs index 64d98d59..3d5e0e5f 100644 --- a/soroban-sdk/src/vec.rs +++ b/soroban-sdk/src/vec.rs @@ -953,7 +953,11 @@ impl VecTryIter { } } - fn into_vec(self) -> Vec { + pub fn into_vec(self) -> Vec { + self.to_vec() + } + + pub fn to_vec(&self) -> Vec { self.vec.slice(self.start..self.end) } }