about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorTyler Mandry <tmandry@gmail.com>2019-10-11 15:09:53 -0700
committerGitHub <noreply@github.com>2019-10-11 15:09:53 -0700
commit48051e4a794ad81402a0c5cc18cfdaab7a09d7ed (patch)
treee53f26c94fabae40cd9d7fd27b4bdd02e3b9814d /src/libstd
parente4eb54dae8a29c15504144dcd494326884e11587 (diff)
parent19bc0a8c674788539e0d93d072517ea3d7d9a998 (diff)
downloadrust-48051e4a794ad81402a0c5cc18cfdaab7a09d7ed.tar.gz
rust-48051e4a794ad81402a0c5cc18cfdaab7a09d7ed.zip
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?
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/path.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/libstd/path.rs b/src/libstd/path.rs
index 966aaec4f0c..ca81044ee85 100644
--- a/src/libstd/path.rs
+++ b/src/libstd/path.rs
@@ -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())
     }