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

solana-ibc: avoid unnecessary String allocation in Router impl #39

Merged
merged 2 commits into from
Oct 19, 2023
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
5 changes: 3 additions & 2 deletions solana/solana-ibc/programs/solana-ibc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// not much we can do about it.
#![allow(clippy::result_large_err)]

use core::borrow::Borrow;
use std::collections::BTreeMap;

use anchor_lang::prelude::*;
Expand Down Expand Up @@ -366,7 +367,7 @@ pub trait SolanaIbcStorageHost {
impl Router for SolanaIbcStorage<'_, '_> {
//
fn get_route(&self, module_id: &ModuleId) -> Option<&dyn Module> {
match module_id.to_string().as_str() {
match module_id.borrow() {
ibc::applications::transfer::MODULE_ID_STR => {
Some(&self.module_holder)
}
Expand All @@ -378,7 +379,7 @@ impl Router for SolanaIbcStorage<'_, '_> {
&mut self,
module_id: &ModuleId,
) -> Option<&mut dyn Module> {
match module_id.to_string().as_str() {
match module_id.borrow() {
ibc::applications::transfer::MODULE_ID_STR => {
Some(&mut self.module_holder)
}
Expand Down
Loading