Skip to content

Commit

Permalink
chore: clippy fix and macro fix
Browse files Browse the repository at this point in the history
  • Loading branch information
CrazyboyQCD committed Jul 12, 2024
1 parent 467f78d commit 4586d24
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions core/string/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
Expand Down Expand Up @@ -1194,7 +1194,7 @@ impl<T: JsStringData> JsStringBuilder<T> {
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 {
Expand All @@ -1205,7 +1205,7 @@ impl<T: JsStringData> JsStringBuilder<T> {
///
/// # 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]
Expand All @@ -1215,7 +1215,7 @@ impl<T: JsStringData> JsStringBuilder<T> {
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 {
Expand Down
4 changes: 2 additions & 2 deletions core/string/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Vec<_>>();
let s_utf16 = utf16.as_slice();
let s_utf8 = &b"Lorem ipsum dolor sit amet"[..];

// utf8 -- test
Expand Down

0 comments on commit 4586d24

Please sign in to comment.