Skip to content

imp(ibc-core): shadowing with the same value #1120

Closed
@rnbguy

Description

Bug Summary

The following two cases are caught by clippy::shadow_unrelated. There are other cases, but these two cases are special as they are using the exact same value. So we can remove the shadowing and use the first binding directly.

  • ibc-core/ics04-channel/src/handler/acknowledgement.rs

https://github.com/cosmos/ibc-rs/blob/e1f19af161878f9daf779aed0f19229f97d54814/ibc-core/ics04-channel/src/handler/acknowledgement.rs#L55-L59

is shadowed by

https://github.com/cosmos/ibc-rs/blob/e1f19af161878f9daf779aed0f19229f97d54814/ibc-core/ics04-channel/src/handler/acknowledgement.rs#L77-L81

Since msg is immutable, both are the same. We can remove second one and use the previous variable directly.

  • ibc-core/ics04-channel/src/handler/timeout.rs

https://github.com/cosmos/ibc-rs/blob/e1f19af161878f9daf779aed0f19229f97d54814/ibc-core/ics04-channel/src/handler/timeout.rs#L67-L68

is shadowed by

https://github.com/cosmos/ibc-rs/blob/e1f19af161878f9daf779aed0f19229f97d54814/ibc-core/ics04-channel/src/handler/timeout.rs#L85-L89

Since packet is immutable, we can use previous one directly.

Details

Version

<= 0.50.0

Metadata

Assignees

Labels

O: code-hygieneObjective: aims to improve code hygiene

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions