Fixed with_extension documentation bug
It was mistakenly calling it with "foo.txt" instead of "txt". I've also added an assert.
This commit is contained in:
parent
5afa2704a6
commit
912a872d3c
@ -1574,7 +1574,8 @@ impl Path {
|
||||
///
|
||||
/// let path = Path::new("/tmp/foo.rs");
|
||||
///
|
||||
/// let new_path = path.with_extension("foo.txt");
|
||||
/// let new_path = path.with_extension("txt");
|
||||
/// assert_eq!(new_path, PathBuf::from("/tmp/foo.txt"));
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn with_extension<S: AsRef<OsStr>>(&self, extension: S) -> PathBuf {
|
||||
|
Loading…
x
Reference in New Issue
Block a user