serenity-rs / poise

Discord bot command framework for serenity, with advanced features like edit tracking and flexible argument parsing
MIT License
597 stars 106 forks source link

[Macros] Reduce generated code for field conversions #260

Closed GnomedDev closed 2 months ago

GnomedDev commented 3 months ago

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.