Skip to content

Commit d111430

Browse files
authored
MsgFundCommunityPool From use Vec::with_capacity (#511)
1 parent 4320bb3 commit d111430

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

cosmrs/src/distribution/msg_fund_community_pool.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ impl TryFrom<&proto::cosmos::distribution::v1beta1::MsgFundCommunityPool> for Ms
3030
fn try_from(
3131
proto: &proto::cosmos::distribution::v1beta1::MsgFundCommunityPool,
3232
) -> Result<MsgFundCommunityPool> {
33-
let mut amounts = vec![];
34-
for amount in proto.amount.iter() {
33+
let mut amounts = Vec::with_capacity(proto.amount.len());
34+
for amount in &proto.amount {
3535
amounts.push(Coin {
3636
denom: amount.denom.parse()?,
3737
amount: amount.amount.parse()?,
@@ -56,8 +56,8 @@ impl From<&MsgFundCommunityPool> for proto::cosmos::distribution::v1beta1::MsgFu
5656
fn from(
5757
msg: &MsgFundCommunityPool,
5858
) -> proto::cosmos::distribution::v1beta1::MsgFundCommunityPool {
59-
let mut amounts = vec![];
60-
for amount in msg.amount.iter() {
59+
let mut amounts = Vec::with_capacity(msg.amount.len());
60+
for amount in &msg.amount {
6161
amounts.push(proto::cosmos::base::v1beta1::Coin {
6262
denom: amount.denom.to_string(),
6363
amount: amount.amount.to_string(),

0 commit comments

Comments
 (0)