Rollup merge of #65266 - rust-lang:must-use-join, r=dtolnay
Mark Path::join as must_use I've accidentally did `mut_path_buf.jon(a_path);`, expecting this to be an in-place modification. Seems like we can easily warn in such cases?
This commit is contained in:
commit
48051e4a79
1 changed files with 1 additions and 0 deletions
|
@ -2219,6 +2219,7 @@ impl Path {
|
||||||
/// assert_eq!(Path::new("/etc").join("passwd"), PathBuf::from("/etc/passwd"));
|
/// assert_eq!(Path::new("/etc").join("passwd"), PathBuf::from("/etc/passwd"));
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
|
#[must_use]
|
||||||
pub fn join<P: AsRef<Path>>(&self, path: P) -> PathBuf {
|
pub fn join<P: AsRef<Path>>(&self, path: P) -> PathBuf {
|
||||||
self._join(path.as_ref())
|
self._join(path.as_ref())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue