Skip to content

Commit

Permalink
remove ALL traces PathBuf's as_mut_vec
Browse files Browse the repository at this point in the history
  • Loading branch information
Borgerr committed Jun 24, 2024
1 parent 564cfc6 commit 5d60720
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 24 deletions.
10 changes: 2 additions & 8 deletions library/std/src/ffi/os_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -552,23 +552,17 @@ impl OsString {
OsStr::from_inner_mut(self.inner.leak())
}

/// Part of a hack to make PathBuf::push/pop more efficient.
//#[inline]
//pub(crate) fn as_mut_vec_for_path_buf(&mut self) -> &mut Vec<u8> {
// self.inner.as_mut_vec_for_path_buf()
//}

/// Provides plumbing to core `Vec::truncate`.
/// More well behaving alternative to allowing outer types
/// full mutable access to the core `Vec`.
/// Provides plumbing to core `Vec::truncate`.
#[inline]
pub(crate) fn truncate(&mut self, len: usize) {
self.inner.truncate(len);
}

/// Provides plumbing to core `Vec::extend_from_slice`.
/// More well behaving alternative to allowing outer types
/// full mutable access to the core `Vec`.
/// Provides plumbing to core `Vec::extend_from_slice`.
#[inline]
pub(crate) fn extend_from_slice(&mut self, other: &[u8]) {
self.inner.extend_from_slice(other);
Expand Down
5 changes: 0 additions & 5 deletions library/std/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1163,11 +1163,6 @@ pub struct PathBuf {
}

impl PathBuf {
//#[inline]
//fn as_mut_vec(&mut self) -> &mut Vec<u8> {
// self.inner.as_mut_vec_for_path_buf()
//}

/// Allocates an empty `PathBuf`.
///
/// # Examples
Expand Down
10 changes: 2 additions & 8 deletions library/std/src/sys/os_str/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,23 +202,17 @@ impl Buf {
self.as_slice().into_rc()
}

/// Part of a hack to make PathBuf::push/pop more efficient.
//#[inline]
//pub(crate) fn as_mut_vec_for_path_buf(&mut self) -> &mut Vec<u8> {
// &mut self.inner
//}

/// Provides plumbing to core `Vec::truncate`.
/// More well behaving alternative to allowing outer types
/// full mutable access to the core `Vec`.
/// Provides plumbing to core `Vec::truncate`.
#[inline]
pub(crate) fn truncate(&mut self, len: usize) {
self.inner.truncate(len);
}

/// Provides plumbing to core `Vec::extend_from_slice`.
/// More well behaving alternative to allowing outer types
/// full mutable access to the core `Vec`.
/// Provides plumbing to core `Vec::extend_from_slice`.
#[inline]
pub(crate) fn extend_from_slice(&mut self, other: &[u8]) {
self.inner.extend_from_slice(other);
Expand Down
4 changes: 2 additions & 2 deletions library/std/src/sys/os_str/wtf8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,17 +165,17 @@ impl Buf {
self.as_slice().into_rc()
}

/// Provides plumbing to core `Vec::truncate`.
/// More well behaving alternative to allowing outer types
/// full mutable access to the core `Vec`.
/// Provides plumbing to core `Vec::truncate`.
#[inline]
pub(crate) fn truncate(&mut self, len: usize) {
self.inner.truncate(len);
}

/// Provides plumbing to core `Vec::extend_from_slice`.
/// More well behaving alternative to allowing outer types
/// full mutable access to the core `Vec`.
/// Provides plumbing to core `Vec::extend_from_slice`.
#[inline]
pub(crate) fn extend_from_slice(&mut self, other: &[u8]) {
self.inner.extend_from_slice(other);
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/sys_common/wtf8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -474,9 +474,9 @@ impl Wtf8Buf {
Wtf8Buf { bytes: bytes.into_vec(), is_known_utf8: false }
}

/// Provides plumbing to core `Vec::extend_from_slice`.
/// More well behaving alternative to allowing outer types
/// full mutable access to the core `Vec`.
/// Provides plumbing to core `Vec::extend_from_slice`.
#[inline]
pub(crate) fn extend_from_slice(&mut self, other: &[u8]) {
self.bytes.extend_from_slice(other);
Expand Down

0 comments on commit 5d60720

Please sign in to comment.