From 61805f12b09a18b0e637db1abaf8ad56fffebce2 Mon Sep 17 00:00:00 2001 From: jedel1043 Date: Sun, 6 Nov 2022 01:25:46 -0600 Subject: [PATCH] Apply clippy --- boa_engine/src/string/mod.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/boa_engine/src/string/mod.rs b/boa_engine/src/string/mod.rs index c4956645418..71f5dfb723f 100644 --- a/boa_engine/src/string/mod.rs +++ b/boa_engine/src/string/mod.rs @@ -287,6 +287,9 @@ pub struct JsString { ptr: TaggedJsString, } +// JsString should always be pointer sized. +sa::assert_eq_size!(JsString, *const ()); + // Safety: `JsString` does not contain any objects which needs to be traced, so this is safe. unsafe impl Trace for JsString { unsafe_empty_trace!(); @@ -944,6 +947,7 @@ mod tests { fn refcount(&self) -> Option { match self.ptr() { JsStringPtrKind::Heap(inner) => { + // SAFETY: The reference count of `JsString` guarantees that `inner` is always valid. let inner = unsafe { inner.as_ref() }; Some(inner.refcount.get()) } @@ -958,12 +962,6 @@ mod tests { assert_eq!(*s, "".encode_utf16().collect::>()); } - #[test] - fn pointer_size() { - assert_eq!(size_of::(), size_of::<*const ()>()); - assert_eq!(size_of::>(), size_of::<*const ()>()); - } - #[test] fn refcount() { let x = js_string!("Hello world");