Clippy practices #375
Labels
A: good-first-issue
Admin: good for newcomers
O: code-hygiene
Objective: cause to improve code hygiene
Milestone
Crate
ibc
Summary
We have inconsistent practices regarding the use of clippy exceptions, in particular to
too_many_arguments
andlarge_enum_variant
. We should decide on a standard.Problem Definition
We sometimes annotate enums with
#[allow(clippy::large_enum_variant)]
to avoid clippy warnings:https://github.com/informalsystems/ibc-rs/blob/12cb1d6187e878eee0e40295fe0b804ddef0b846/modules/src/ics02_client/msgs.rs#L13-L18
And sometimes we box large enum variants for the same reason (to avoid clippy warnings):
https://github.com/informalsystems/ibc-rs/blob/12cb1d6187e878eee0e40295fe0b804ddef0b846/modules/src/ics03_connection/msgs.rs#L29-L34
The
too_many_arguments
check also poses issues, for example this method has 11 arguments, but clippy issues warnings for anything larger than 7:https://github.com/informalsystems/ibc-rs/blob/12cb1d6187e878eee0e40295fe0b804ddef0b846/modules/src/ics07_tendermint/client_state.rs#L34-L47
While we're at it, we should also consider doing a sweeping through the repo and clean other clippy exception, for example:
https://github.com/informalsystems/ibc-rs/blob/c32393a4f344877e34957d13a768e6623486c587/modules/src/tx_msg.rs#L15
Improvement proposal:
Original discussion
I wonder if we can have a clippy config to parametrize the "too_many_arguments" threshold (default is 7) for this crate, since we're using this allow quite often. We are also cutting some corners with allowing
large_enum_variant
.Originally posted by @adizere in #355 (comment)
In future, I think this deserves a discussion about clippy in general, if we want to have a repo-wide configuration where we adjust the clippy parameters ... so we can remove the allow/clippy annotations altogether. I can open an issue to track this if that seems interesting.
Originally posted by @adizere in #355 (comment)
For Admin Use
The text was updated successfully, but these errors were encountered: