matklad / once_cell

Rust library for single assignment cells and lazy statics without macros
Apache License 2.0
1.87k stars 109 forks source link

reduce duplicated code #263

Open brodycj opened 1 month ago

brodycj commented 1 month ago

While working on PR #260, I noticed what looks like quite a bit of duplicated code. I am wondering if we could find some kind of idiomatic way to make some generic structures & functions to help reduce the amount of duplicated code. I would love to take a look into this at some point.

matklad commented 1 week ago

Perhaps we could reduce duplication indeed, but a hard requirement here is to also simplify the code along the way. Between duplication and more complex code, I would prefer duplication.