Skip to content

Commit c70e4d7

Browse files
authored
Path::with_extension: show that it adds an extension where one did not exist
I think the times I encountered this, I had to check first if files without extensions were added, since all examples only had files with existing extensions. Also, this replaced example already has a similar example below.
1 parent 3e674b0 commit c70e4d7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

library/std/src/path.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2741,7 +2741,7 @@ impl Path {
27412741
/// ```
27422742
/// use std::path::{Path, PathBuf};
27432743
///
2744-
/// let path = Path::new("foo.rs");
2744+
/// let path = Path::new("foo");
27452745
/// assert_eq!(path.with_extension("txt"), PathBuf::from("foo.txt"));
27462746
///
27472747
/// let path = Path::new("foo.tar.gz");

0 commit comments

Comments
 (0)