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:
Tyler Mandry 2019-10-11 15:09:53 -07:00 committed by GitHub
commit 48051e4a79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2219,6 +2219,7 @@ impl Path {
/// assert_eq!(Path::new("/etc").join("passwd"), PathBuf::from("/etc/passwd"));
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[must_use]
pub fn join<P: AsRef<Path>>(&self, path: P) -> PathBuf {
self._join(path.as_ref())
}