rust-unofficial / patterns

A catalogue of Rust design patterns, anti-patterns and idioms
https://rust-unofficial.github.io/patterns/
Mozilla Public License 2.0
8.11k stars 375 forks source link

Anti-pattern std::sync::Once #19

Open Sean1708 opened 8 years ago

Sean1708 commented 8 years ago

I think this is a fairly uncontroversial example of an anti-pattern, but I don't think many people realise that std::sync::Once even exists.

briansmith commented 8 years ago

One could argue that even direct use of std::sync::Once is an anti-pattern and lazy_static! should almost always be used instead.