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

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

Closed
rnbguy opened this issue Mar 12, 2024 · 0 comments · Fixed by #1119
Closed

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

rnbguy opened this issue Mar 12, 2024 · 0 comments · Fixed by #1119
Assignees
Labels
O: code-hygiene Objective: aims to improve code hygiene
Milestone

Comments

@rnbguy
Copy link
Member

rnbguy commented Mar 12, 2024

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

@rnbguy rnbguy mentioned this issue Mar 12, 2024
7 tasks
@github-project-automation github-project-automation bot moved this to 📥 To Do in ibc-rs Mar 12, 2024
@Farhad-Shabani Farhad-Shabani added the O: code-hygiene Objective: aims to improve code hygiene label Mar 12, 2024
@Farhad-Shabani Farhad-Shabani added this to the 0.51.0 milestone Mar 12, 2024
@github-project-automation github-project-automation bot moved this from 📥 To Do to ✅ Done in ibc-rs Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O: code-hygiene Objective: aims to improve code hygiene
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants