Skip to content

Commit

Permalink
Cleaner cstr code
Browse files Browse the repository at this point in the history
  • Loading branch information
topjohnwu committed Oct 12, 2023
1 parent eda8c70 commit 6d1e8d8
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions native/src/base/cstr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ macro_rules! impl_str_write {
impl<$($g)*> AsMut<Utf8CStr> for $t {
#[inline(always)]
fn as_mut(&mut self) -> &mut Utf8CStr {
self
self.as_utf8_cstr_mut()
}
}
)*}
Expand Down Expand Up @@ -597,10 +597,8 @@ macro_rules! impl_str_buf {
}
#[inline(always)]
fn clear(&mut self) {
unsafe {
self.mut_buf()[0] = b'\0';
self.set_len(0);
}
self.buf[0] = b'\0';
self.used = 0;
}
}
)*}
Expand Down

0 comments on commit 6d1e8d8

Please sign in to comment.