Skip to content

Commit 8a16f4e

Browse files
committed
chore: mark some &mut self tagged methods const
1 parent 48153a0 commit 8a16f4e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

core/string/src/builder.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ impl<D: Copy> JsStringBuilder<D> {
6060
/// - The elements at `old_len..new_len` must be initialized.
6161
///
6262
#[inline]
63-
pub unsafe fn set_len(&mut self, new_len: usize) {
63+
pub const unsafe fn set_len(&mut self, new_len: usize) {
6464
debug_assert!(new_len <= self.capacity());
6565

6666
self.len = new_len;
@@ -140,7 +140,7 @@ impl<D: Copy> JsStringBuilder<D> {
140140
///
141141
/// Caller should ensure that the inner is allocated.
142142
#[must_use]
143-
unsafe fn data(&self) -> *mut D {
143+
const unsafe fn data(&self) -> *mut D {
144144
// SAFETY:
145145
// Caller should ensure that the inner is allocated.
146146
unsafe { (&raw mut (*self.inner.as_ptr()).data).cast() }
@@ -205,7 +205,7 @@ impl<D: Copy> JsStringBuilder<D> {
205205
///
206206
/// Caller should ensure the capacity is large enough to hold elements.
207207
#[inline]
208-
pub unsafe fn extend_from_slice_unchecked(&mut self, v: &[D]) {
208+
pub const unsafe fn extend_from_slice_unchecked(&mut self, v: &[D]) {
209209
// SAFETY: Caller should ensure the capacity is large enough to hold elements.
210210
unsafe {
211211
ptr::copy_nonoverlapping(v.as_ptr(), self.data().add(self.len()), v.len());
@@ -294,7 +294,7 @@ impl<D: Copy> JsStringBuilder<D> {
294294
///
295295
/// Caller should ensure the capacity is large enough to hold elements.
296296
#[inline]
297-
pub unsafe fn push_unchecked(&mut self, v: D) {
297+
pub const unsafe fn push_unchecked(&mut self, v: D) {
298298
// SAFETY: Caller should ensure the capacity is large enough to hold elements.
299299
unsafe {
300300
self.data().add(self.len()).write(v);

0 commit comments

Comments
 (0)