aptos-core icon indicating copy to clipboard operation
aptos-core copied to clipboard

[Code Quality] Find (or implement) a custom human-readable label derive.

Open JoshLind opened this issue 3 years ago • 3 comments

We have a load of places in our code base where we implement custom human-readable labels (e.g., for enums). For example:

  • https://github.com/aptos-labs/aptos-core/blob/7af7ffe81e3fe4ac85daf22babdfad5c3b56de43/state-sync/aptos-data-client/src/lib.rs#L47
  • https://github.com/aptos-labs/aptos-core/blob/7af7ffe81e3fe4ac85daf22babdfad5c3b56de43/state-sync/aptos-data-client/src/lib.rs#L199
  • https://github.com/aptos-labs/aptos-core/blob/94217183fd3cfe248db6947a05db61917e3af293/state-sync/storage-service/types/src/lib.rs#L67
  • ....

There must be a crate that could do this for us. If not, we should create our own macro derive to handle this. This seems like a good starter task.

JoshLind avatar Apr 15 '22 23:04 JoshLind

strum? We used to use it, but stopped doing so and worked around it as part of the external dependency removal effort. https://docs.rs/strum/latest/strum/derive.AsRefStr.html

msmouse avatar Apr 17 '22 17:04 msmouse

Jeez, those guys that were anal about dependencies... hahahaha

davidiw avatar Apr 23 '22 16:04 davidiw

This issue is stale because it has been open 45 days with no activity. Remove the stale label or comment - otherwise this will be closed in 15 days.

github-actions[bot] avatar Nov 07 '22 06:11 github-actions[bot]

This issue is stale because it has been open 45 days with no activity. Remove the stale label or comment - otherwise this will be closed in 15 days.

github-actions[bot] avatar Dec 23 '22 02:12 github-actions[bot]