Skip to content

Commit

Permalink
Rollup merge of rust-lang#65266 - rust-lang:must-use-join, r=dtolnay
Browse files Browse the repository at this point in the history
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?
  • Loading branch information
tmandry authored Oct 11, 2019
2 parents e4eb54d + 19bc0a8 commit 48051e4
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/libstd/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
Expand Down

0 comments on commit 48051e4

Please sign in to comment.