diff --git a/core/string/src/lib.rs b/core/string/src/lib.rs index f7183882b0d..cb42d58847f 100644 --- a/core/string/src/lib.rs +++ b/core/string/src/lib.rs @@ -1145,7 +1145,7 @@ impl ToStringEscaped for [u16] { .collect() } } -/// Inner elements represented for [`RawJsString`]. +/// Inner elements represented for `RawJsString`. pub trait JsStringData: std::fmt::Display {} impl JsStringData for u8 {} @@ -1194,7 +1194,7 @@ impl JsStringBuilder { Self::NEW } - /// Returns the number of elements in the inner [`RawJsString`], also referred to + /// Returns the number of elements in the inner `RawJsString`, also referred to #[inline] #[must_use] pub fn len(&self) -> usize { @@ -1205,7 +1205,7 @@ impl JsStringBuilder { /// /// # Safety /// - /// - `new_len` must be less than or equal to [`capacity()`]. + /// - `new_len` must be less than or equal to `capacity()`. /// - The elements at `old_len..new_len` must be initialized. /// #[inline] @@ -1215,7 +1215,7 @@ impl JsStringBuilder { self.len = new_len; } - /// Returns the total number of elements the inner [`RawJsString`] can hold without reallocating + /// Returns the total number of elements the inner `RawJsString` can hold without reallocating #[inline] #[must_use] pub fn capacity(&self) -> usize { diff --git a/core/string/src/tests.rs b/core/string/src/tests.rs index 0419f5ef320..075dc1ae0ee 100644 --- a/core/string/src/tests.rs +++ b/core/string/src/tests.rs @@ -167,8 +167,8 @@ fn conversion_to_known_static_js_string() { #[test] fn js_string_builder() { - let _s_utf16 = utf16!("2024年5月21日").repeat(10); - let s_utf16 = _s_utf16.as_slice(); + let utf16 = "2024年5月21日".encode_utf16().collect::>(); + let s_utf16 = utf16.as_slice(); let s_utf8 = &b"Lorem ipsum dolor sit amet"[..]; // utf8 -- test