Skip to content

Commit

Permalink
Mark Path::join as must_use
Browse files Browse the repository at this point in the history
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
matklad authored Oct 10, 2019
1 parent 8ee24f6 commit 19bc0a8
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 19bc0a8

Please sign in to comment.