Rollup merge of #89729 - jkugelman:must-use-core-std-constructors, r=joshtriplett

Add #[must_use] to core and std constructors

Parent issue: #89692

r? ``@joshtriplett``
This commit is contained in:
Guillaume Gomez
2021-10-11 14:11:43 +02:00
committed by GitHub
21 changed files with 36 additions and 0 deletions

View File

@@ -1146,6 +1146,7 @@ impl PathBuf {
/// let path = PathBuf::new();
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[must_use]
#[inline]
pub fn new() -> PathBuf {
PathBuf { inner: OsString::new() }
@@ -1170,6 +1171,7 @@ impl PathBuf {
///
/// [`with_capacity`]: OsString::with_capacity
#[stable(feature = "path_buf_capacity", since = "1.44.0")]
#[must_use]
#[inline]
pub fn with_capacity(capacity: usize) -> PathBuf {
PathBuf { inner: OsString::with_capacity(capacity) }