Fixes for implementation of PathBuf methods (aliases for OsString)
- Fixed incorrect `mut` usage - Fixed style in accordance with tidy - Marked all methods as unstable - Changed feature identifier to path_buf_alias_os_string_methods
This commit is contained in:
parent
a23c40ec94
commit
dbf60d9ca1
1 changed files with 19 additions and 19 deletions
|
@ -1137,7 +1137,7 @@ impl PathBuf {
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// use std::path::PathBuf;
|
/// use std::path::PathBuf;
|
||||||
///
|
///
|
||||||
/// let path = PathBuf::new();
|
/// let path = PathBuf::new();
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
|
@ -1145,26 +1145,26 @@ impl PathBuf {
|
||||||
PathBuf { inner: OsString::new() }
|
PathBuf { inner: OsString::new() }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a new `PathBuf` with a given capacity used to create the
|
/// Creates a new `PathBuf` with a given capacity used to create the
|
||||||
/// internal [`OsString`]. See [`with_capacity`] defined on [`OsString`].
|
/// internal [`OsString`]. See [`with_capacity`] defined on [`OsString`].
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// use std::path::PathBuf;
|
/// use std::path::PathBuf;
|
||||||
///
|
///
|
||||||
/// let path = PathBuf::with_capacity(10);
|
/// let path = PathBuf::with_capacity(10);
|
||||||
/// let capacity = path.capacity();
|
/// let capacity = path.capacity();
|
||||||
///
|
///
|
||||||
/// // This push is done without reallocating
|
/// // This push is done without reallocating
|
||||||
/// path.push(r"C:\");
|
/// path.push(r"C:\");
|
||||||
///
|
///
|
||||||
/// assert_eq!(capacity, path.capacity());
|
/// assert_eq!(capacity, path.capacity());
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// [`with_capacity`]: ../ffi/struct.OsString.html#method.with_capacity
|
/// [`with_capacity`]: ../ffi/struct.OsString.html#method.with_capacity
|
||||||
/// [`OsString`]: ../ffi/struct.OsString.html
|
/// [`OsString`]: ../ffi/struct.OsString.html
|
||||||
#[stable(feature = "path_buf_os_string_methods", since = "1.33.0")]
|
#[unstable(feature = "path_buf_alias_os_string_methods", issue = "58234")]
|
||||||
pub fn with_capacity(capacity: usize) -> PathBuf {
|
pub fn with_capacity(capacity: usize) -> PathBuf {
|
||||||
PathBuf {
|
PathBuf {
|
||||||
inner: OsString::with_capacity(capacity)
|
inner: OsString::with_capacity(capacity)
|
||||||
|
@ -1404,8 +1404,8 @@ impl PathBuf {
|
||||||
///
|
///
|
||||||
/// [`capacity`]: ../ffi/struct.OsString.html#method.capacity
|
/// [`capacity`]: ../ffi/struct.OsString.html#method.capacity
|
||||||
/// [`OsString`]: ../ffi/struct.OsString.html
|
/// [`OsString`]: ../ffi/struct.OsString.html
|
||||||
#[stable(feature = "path_buf_os_string_methods", since = "1.33.0")]
|
#[unstable(feature = "path_buf_alias_os_string_methods", issue = "58234")]
|
||||||
pub fn capacity(self) -> usize {
|
pub fn capacity(&self) -> usize {
|
||||||
self.inner.capacity()
|
self.inner.capacity()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1413,8 +1413,8 @@ impl PathBuf {
|
||||||
///
|
///
|
||||||
/// [`clear`]: ../ffi/struct.OsString.html#method.clear
|
/// [`clear`]: ../ffi/struct.OsString.html#method.clear
|
||||||
/// [`OsString`]: ../ffi/struct.OsString.html
|
/// [`OsString`]: ../ffi/struct.OsString.html
|
||||||
#[stable(feature = "path_buf_os_string_methods", since = "1.33.0")]
|
#[unstable(feature = "path_buf_alias_os_string_methods", issue = "58234")]
|
||||||
pub fn clear(mut self) {
|
pub fn clear(&mut self) {
|
||||||
self.inner.clear()
|
self.inner.clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1422,8 +1422,8 @@ impl PathBuf {
|
||||||
///
|
///
|
||||||
/// [`reserve`]: ../ffi/struct.OsString.html#method.reserve
|
/// [`reserve`]: ../ffi/struct.OsString.html#method.reserve
|
||||||
/// [`OsString`]: ../ffi/struct.OsString.html
|
/// [`OsString`]: ../ffi/struct.OsString.html
|
||||||
#[stable(feature = "path_buf_os_string_methods", since = "1.33.0")]
|
#[unstable(feature = "path_buf_alias_os_string_methods", issue = "58234")]
|
||||||
pub fn reserve(mut self, additional: usize) {
|
pub fn reserve(&mut self, additional: usize) {
|
||||||
self.inner.reserve(additional)
|
self.inner.reserve(additional)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1431,8 +1431,8 @@ impl PathBuf {
|
||||||
///
|
///
|
||||||
/// [`reserve_exact`]: ../ffi/struct.OsString.html#method.reserve_exact
|
/// [`reserve_exact`]: ../ffi/struct.OsString.html#method.reserve_exact
|
||||||
/// [`OsString`]: ../ffi/struct.OsString.html
|
/// [`OsString`]: ../ffi/struct.OsString.html
|
||||||
#[stable(feature = "path_buf_os_string_methods", since = "1.33.0")]
|
#[unstable(feature = "path_buf_alias_os_string_methods", issue = "58234")]
|
||||||
pub fn reserve_exact(mut self, additional: usize) {
|
pub fn reserve_exact(&mut self, additional: usize) {
|
||||||
self.inner.reserve_exact(additional)
|
self.inner.reserve_exact(additional)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1440,8 +1440,8 @@ impl PathBuf {
|
||||||
///
|
///
|
||||||
/// [`shrink_to_fit`]: ../ffi/struct.OsString.html#method.shrink_to_fit
|
/// [`shrink_to_fit`]: ../ffi/struct.OsString.html#method.shrink_to_fit
|
||||||
/// [`OsString`]: ../ffi/struct.OsString.html
|
/// [`OsString`]: ../ffi/struct.OsString.html
|
||||||
#[stable(feature = "path_buf_os_string_methods", since = "1.33.0")]
|
#[unstable(feature = "path_buf_alias_os_string_methods", issue = "58234")]
|
||||||
pub fn shrink_to_fit(mut self) {
|
pub fn shrink_to_fit(&mut self) {
|
||||||
self.inner.shrink_to_fit()
|
self.inner.shrink_to_fit()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1449,8 +1449,8 @@ impl PathBuf {
|
||||||
///
|
///
|
||||||
/// [`shrink_to`]: ../ffi/struct.OsString.html#method.shrink_to
|
/// [`shrink_to`]: ../ffi/struct.OsString.html#method.shrink_to
|
||||||
/// [`OsString`]: ../ffi/struct.OsString.html
|
/// [`OsString`]: ../ffi/struct.OsString.html
|
||||||
#[stable(feature = "path_buf_os_string_methods", since = "1.33.0")]
|
#[unstable(feature = "path_buf_alias_os_string_methods", issue = "58234")]
|
||||||
pub fn shrink_to(mut self, min_capacity: usize) {
|
pub fn shrink_to(&mut self, min_capacity: usize) {
|
||||||
self.inner.shrink_to(min_capacity)
|
self.inner.shrink_to(min_capacity)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue