Skip to content

Commit dbf60d9

Browse files
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
1 parent a23c40e commit dbf60d9

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

src/libstd/path.rs

+19-19
Original file line numberDiff line numberDiff line change
@@ -1137,34 +1137,34 @@ impl PathBuf {
11371137
///
11381138
/// ```
11391139
/// use std::path::PathBuf;
1140-
///
1140+
///
11411141
/// let path = PathBuf::new();
11421142
/// ```
11431143
#[stable(feature = "rust1", since = "1.0.0")]
11441144
pub fn new() -> PathBuf {
11451145
PathBuf { inner: OsString::new() }
11461146
}
11471147

1148-
/// Creates a new `PathBuf` with a given capacity used to create the
1148+
/// Creates a new `PathBuf` with a given capacity used to create the
11491149
/// internal [`OsString`]. See [`with_capacity`] defined on [`OsString`].
11501150
///
11511151
/// # Examples
1152-
///
1152+
///
11531153
/// ```
11541154
/// use std::path::PathBuf;
1155-
///
1155+
///
11561156
/// let path = PathBuf::with_capacity(10);
11571157
/// let capacity = path.capacity();
1158-
///
1158+
///
11591159
/// // This push is done without reallocating
11601160
/// path.push(r"C:\");
11611161
///
11621162
/// assert_eq!(capacity, path.capacity());
11631163
/// ```
1164-
///
1164+
///
11651165
/// [`with_capacity`]: ../ffi/struct.OsString.html#method.with_capacity
11661166
/// [`OsString`]: ../ffi/struct.OsString.html
1167-
#[stable(feature = "path_buf_os_string_methods", since = "1.33.0")]
1167+
#[unstable(feature = "path_buf_alias_os_string_methods", issue = "58234")]
11681168
pub fn with_capacity(capacity: usize) -> PathBuf {
11691169
PathBuf {
11701170
inner: OsString::with_capacity(capacity)
@@ -1404,53 +1404,53 @@ impl PathBuf {
14041404
///
14051405
/// [`capacity`]: ../ffi/struct.OsString.html#method.capacity
14061406
/// [`OsString`]: ../ffi/struct.OsString.html
1407-
#[stable(feature = "path_buf_os_string_methods", since = "1.33.0")]
1408-
pub fn capacity(self) -> usize {
1407+
#[unstable(feature = "path_buf_alias_os_string_methods", issue = "58234")]
1408+
pub fn capacity(&self) -> usize {
14091409
self.inner.capacity()
14101410
}
14111411

14121412
/// Invokes [`clear`] on the underlying instance of [`OsString`].
14131413
///
14141414
/// [`clear`]: ../ffi/struct.OsString.html#method.clear
14151415
/// [`OsString`]: ../ffi/struct.OsString.html
1416-
#[stable(feature = "path_buf_os_string_methods", since = "1.33.0")]
1417-
pub fn clear(mut self) {
1416+
#[unstable(feature = "path_buf_alias_os_string_methods", issue = "58234")]
1417+
pub fn clear(&mut self) {
14181418
self.inner.clear()
14191419
}
14201420

14211421
/// Invokes [`reserve`] on the underlying instance of [`OsString`].
14221422
///
14231423
/// [`reserve`]: ../ffi/struct.OsString.html#method.reserve
14241424
/// [`OsString`]: ../ffi/struct.OsString.html
1425-
#[stable(feature = "path_buf_os_string_methods", since = "1.33.0")]
1426-
pub fn reserve(mut self, additional: usize) {
1425+
#[unstable(feature = "path_buf_alias_os_string_methods", issue = "58234")]
1426+
pub fn reserve(&mut self, additional: usize) {
14271427
self.inner.reserve(additional)
14281428
}
14291429

14301430
/// Invokes [`reserve_exact`] on the underlying instance of [`OsString`].
14311431
///
14321432
/// [`reserve_exact`]: ../ffi/struct.OsString.html#method.reserve_exact
14331433
/// [`OsString`]: ../ffi/struct.OsString.html
1434-
#[stable(feature = "path_buf_os_string_methods", since = "1.33.0")]
1435-
pub fn reserve_exact(mut self, additional: usize) {
1434+
#[unstable(feature = "path_buf_alias_os_string_methods", issue = "58234")]
1435+
pub fn reserve_exact(&mut self, additional: usize) {
14361436
self.inner.reserve_exact(additional)
14371437
}
14381438

14391439
/// Invokes [`shrink_to_fit`] on the underlying instance of [`OsString`].
14401440
///
14411441
/// [`shrink_to_fit`]: ../ffi/struct.OsString.html#method.shrink_to_fit
14421442
/// [`OsString`]: ../ffi/struct.OsString.html
1443-
#[stable(feature = "path_buf_os_string_methods", since = "1.33.0")]
1444-
pub fn shrink_to_fit(mut self) {
1443+
#[unstable(feature = "path_buf_alias_os_string_methods", issue = "58234")]
1444+
pub fn shrink_to_fit(&mut self) {
14451445
self.inner.shrink_to_fit()
14461446
}
14471447

14481448
/// Invokes [`shrink_to`] on the underlying instance of [`OsString`].
14491449
///
14501450
/// [`shrink_to`]: ../ffi/struct.OsString.html#method.shrink_to
14511451
/// [`OsString`]: ../ffi/struct.OsString.html
1452-
#[stable(feature = "path_buf_os_string_methods", since = "1.33.0")]
1453-
pub fn shrink_to(mut self, min_capacity: usize) {
1452+
#[unstable(feature = "path_buf_alias_os_string_methods", issue = "58234")]
1453+
pub fn shrink_to(&mut self, min_capacity: usize) {
14541454
self.inner.shrink_to(min_capacity)
14551455
}
14561456
}

0 commit comments

Comments
 (0)