Skip to content

Commit

Permalink
MsgFundCommunityPool From use Vec::with_capacity
Browse files Browse the repository at this point in the history
  • Loading branch information
nkysg committed Oct 31, 2024
1 parent 3f836e6 commit 7a4fea7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cosmrs/src/distribution/msg_fund_community_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ impl TryFrom<&proto::cosmos::distribution::v1beta1::MsgFundCommunityPool> for Ms
fn try_from(
proto: &proto::cosmos::distribution::v1beta1::MsgFundCommunityPool,
) -> Result<MsgFundCommunityPool> {
let mut amounts = vec![];
for amount in proto.amount.iter() {
let mut amounts = Vec::with_capacity(proto.amount.len());
for amount in &proto.amount {
amounts.push(Coin {
denom: amount.denom.parse()?,
amount: amount.amount.parse()?,
Expand All @@ -56,8 +56,8 @@ impl From<&MsgFundCommunityPool> for proto::cosmos::distribution::v1beta1::MsgFu
fn from(
msg: &MsgFundCommunityPool,
) -> proto::cosmos::distribution::v1beta1::MsgFundCommunityPool {
let mut amounts = vec![];
for amount in msg.amount.iter() {
let mut amounts = Vec::with_capacity(msg.amount.len());
for amount in &msg.amount {
amounts.push(proto::cosmos::base::v1beta1::Coin {
denom: amount.denom.to_string(),
amount: amount.amount.to_string(),
Expand Down

0 comments on commit 7a4fea7

Please sign in to comment.