rustfmt
                                
                                 rustfmt copied to clipboard
                                
                                    rustfmt copied to clipboard
                            
                            
                            
                        use std::lazy::SyncLazy instead of lazy_static
Can we use the nightly feature once_cell?
Thanks for your first PR!
Can we use the nightly feature
once_cell?
Speaking for myself, I don't see why we couldn't use it. I'm personally not too familiar with the once_cell feature. It would be great if you could elaborate on the advantages to using this over lazy_static!. Is the idea just to replace a 3rd party dependency?
- Remove a 3rd party dependency
- Macro free
- When the feature is stabled, we can just switch over it
- Performance improvement according to this https://github.com/async-rs/async-std/issues/406
This is the once_cell tracing issue: https://github.com/rust-lang/rust/issues/74465
That all sounds awesome! Thanks for including those links. I'll be sure to give them a read 😄
Thanks for the PR!
We've historically stayed away from any gated features (obviously excluding rustc_private which we need for consuming compiler internals). However, while I'm not sure I'm ready to take the plunge into using unstable features I also think we're kidding ourselves if we continue that refrain based on hopes of being able to build with a stable compiler some day.
That being said, I'm still on the fence about this one as I don't think it buys us all that much just yet, given that lazy_static is still in our build graph due to various transitive dependencies and we'd technically be pulling in once_cell too.
I concur that this is the right move strategically, but not quite convinced yet that it's all that beneficial today. Will leave it parked for a bit in case I change my mind.
This one is still on hold, but I wanted to mention that the latest tracking issue for this is https://github.com/rust-lang/rust/issues/109736.
lazy_static was removed in #6154