Skip to content

Commit 6b733ea

Browse files
committed
go
1 parent 95fc0e8 commit 6b733ea

File tree

1 file changed

+5
-10
lines changed
  • crates/oxc_formatter/src/formatter/format_element

1 file changed

+5
-10
lines changed

crates/oxc_formatter/src/formatter/format_element/mod.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
pub mod document;
22
pub mod tag;
33

4+
use std::cell::Cell;
45
// #[cfg(target_pointer_width = "64")]
56
// use biome_rowan::static_assert;
67
use std::hash::{Hash, Hasher};
7-
use std::mem;
8+
use std::mem::{self, ManuallyDrop};
89
use std::num::NonZeroU32;
910
use 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

160155
impl<'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

0 commit comments

Comments
 (0)