File tree Expand file tree Collapse file tree 1 file changed +5
-10
lines changed
crates/oxc_formatter/src/formatter/format_element Expand file tree Collapse file tree 1 file changed +5
-10
lines changed Original file line number Diff line number Diff line change 11pub mod document;
22pub mod tag;
33
4+ use std:: cell:: Cell ;
45// #[cfg(target_pointer_width = "64")]
56// use biome_rowan::static_assert;
67use std:: hash:: { Hash , Hasher } ;
7- use std:: mem;
8+ use std:: mem:: { self , ManuallyDrop } ;
89use std:: num:: NonZeroU32 ;
910use std:: { borrow:: Cow , ops:: Deref , rc:: Rc } ;
1011
@@ -148,18 +149,12 @@ impl PrintMode {
148149 }
149150}
150151
151- pub struct Interned < ' a > ( ArenaVec < ' a , FormatElement < ' a > > ) ;
152-
153- impl Clone for Interned < ' _ > {
154- fn clone ( & self ) -> Self {
155- // SAFETY: NOT sure if it is safe, but needed to implement Clone.
156- unsafe { mem:: transmute_copy ( self ) }
157- }
158- }
152+ #[ derive( Clone ) ]
153+ pub struct Interned < ' a > ( ManuallyDrop < Rc < ArenaVec < ' a , FormatElement < ' a > > > > ) ;
159154
160155impl < ' a > Interned < ' a > {
161156 pub ( super ) fn new ( content : ArenaVec < ' a , FormatElement < ' a > > ) -> Self {
162- Self ( content)
157+ Self ( ManuallyDrop :: new ( Rc :: new ( content) ) )
163158 }
164159}
165160
You can’t perform that action at this time.
0 commit comments