Skip to content

Commit

Permalink
solana-ibc: avoid unnecessary String allocation in Router impl (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
mina86 authored Oct 19, 2023
1 parent da43fd5 commit f276d85
Showing 1 changed file with 3 additions and 2 deletions.
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 @@ -418,7 +419,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 @@ -430,7 +431,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

0 comments on commit f276d85

Please sign in to comment.