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

[Macros] Reduce generated code for field conversions #260

Merged
merged 2 commits into from
May 4, 2024

Conversation

GnomedDev
Copy link
Member

This moves all the implementations of vec_tuple_2_to_hash_map into calling the actual function, now iter_ to allow for these generics. This then adds an early return for the iterator having no items, which gets rid of the somewhat silly vec![].into_iter().collect() and HashMap::from_iter([]) code.

This also does the same for wrap_option, removing the None.map(Duration::from_secs) that was in CooldownConfig.

@GnomedDev GnomedDev merged commit 5b369bb into serenity-rs:current May 4, 2024
12 checks passed
@GnomedDev GnomedDev deleted the reduce-useless-operations branch May 4, 2024 00:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants